How to Deploy Your Nodejs App on Centos 7
PM2 is a process manager for nodejs apps. It daemonizes apps built with nodejs, which means run-as-service.
Let’s install PM2 using npm.
1npm install -g pm2@latest
Now you can start your app using pm2 like so:
1pm2 start app.js
Next, register the app as startup process.
1pm2 startup systemd 2pm2 save
You can check the currently running apps like so:
Remember your app name or id so that you can use it to restart or stop the service.
Simply hitting pm2 command will show you pm2 help.
Happy coding! 🙂