Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NodeJS in production [closed]

Tags:

node.js

I have to ask you guys a question. I just started looking at NodeJS for a project with some friends of mine. Now we have reached the point in our planning that we have started to think about how a NodeJS solution is deployed in production. Do we need a web server for this (IIS or Apache)? My initial thought is "no" since this will force to declare ports twice, once in the web server and once in the NodeJS code. Or should NodeJS just be run as "node server.js"?

like image 304
Andreas Selenwall Avatar asked Sep 14 '12 04:09

Andreas Selenwall


People also ask

Can I use node js in production?

You can signal Node. js that you are running in production by setting the NODE_ENV=production environment variable. in the shell, but it's better to put it in your shell configuration file (e.g. . bash_profile with the Bash shell) because otherwise the setting does not persist in case of a system restart.

Is node js in demand 2022?

Node. js development has become very popular over the last four years and continues to stand the competition in 2022 making startups worldwide choose it over other available options.

Is node js still in demand?

Developers who need a high-paying job should look into Node. js. This popular JavaScript tool has been around for decades, but the demand for people who can master it is still going strong.

How do I run node js app forever when console is closed?

js application locally after closing the terminal or Application, to run the nodeJS application permanently. We use NPM modules such as forever or PM2 to ensure that a given script runs continuously. NPM is a Default Package manager for Node.


1 Answers

To run NodeJS you just node server.js but there are a few better extensions that handle that. So, you can run node in windows, but I highly recommend UNIX platforms through SSH access to your server (most of VPS have this). If you cannot afford such type of server, I'd go with Heroku, Dotcloud or Nodejitsu (the three of them are cloud hosting).

  • Forever which restarts your node server when it crashes
  • Nodemon which restarts your node server when the file has been modified (or any JS files in a specified directory)

There might be more, so if I find anything useful, I'll edit this post.

like image 188
Tom Roggero Avatar answered Nov 15 '22 07:11

Tom Roggero