Using PM2 module:
- Installing module in project Directory:
npm install pm2 -g
- Start Your Node.js Application by pm2.
pm2 start [Your fileName]
- All processes listed up which are registered with pm2.
- We can also stop any process runs by pm2 stop command:
pm2 stop all pm2 stop [id number]
Using forever module
- Installing module in your project Directory:
npm install forever -g
- Start Your Node.js Application by forever module.
forever start [Your FileName]
- All processes listed up which are registered with forever
- We can also remove or stop any processes that are registered with forever using index (such as 0 in this case)
forever stopall forever stop [index]
So now your Application will be running permanently even after exiting the terminal or Application.
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.