Deployment using process manager
suggest changeA process manager is commonly used in production to run a Node.js app. It restarts the process if it crashes, and it can report resource use and logs.
Some of the popular process managers made by the node community are forever, pm2, etc.
Forever
forever is a command-line interface tool for ensuring that a given script runs continuously. forever’s simple interface makes it ideal for running smaller deployments of Node.js apps and scripts.
forever monitors your process and restarts it if it crashes.
Install forever globally.
$ npm install -g forever
Run application :
$ forever start server.js
This starts the server and gives an id for the process(starts from 0).
Restart application :
$ forever restart 0
Here 0 is the id of the server.
Stop application :
$ forever stop 0
As with restart, 0 is the id forever assigned. You can also pass a pid or the script name instead of that id.
For more commands : https://www.npmjs.com/package/forever