Good day, developers!
Today, we'll look at the node process manager, its visually appealing interface, and its basic syntax.
pm2 is a production process manager for Node.js applications with a built-in load balancer. It allows you to keep applications alive forever, to reload them without downtime and to facilitate common system admin tasks. resources.
I love the keep applications alive forever part because
Because of its visual depiction, I might prefer this to Nodemon. Let me know what you think in the comments area. Now that we've gotten that out of the way, let's get down to business.
I'll be utilizing a node qr project that Olubisi Idris authored. link here.
Setup
๐ณ Install the pm2 package
npm i -g pm2
๐ณ To start your node server run this command.
pm2 start [entry file]. In my case pm2 start app.js
๐ณ A quick check to know if our server is running
Run: pm2 logs
๐ณ Stop the pm2
pm2 stop <app_name|namespace|id|'all'|json_conf>
This means you can use either the app name, id or all
pm2 stop 0
๐ณ To restart pm2 restart 0
๐ณ To see full description of application
pm2 describe 0
Discuss.
Why will you choose this over other node application starters
.