What is PM2? Why we use it?

Viewed 20

Can someone explain to me what the purpose of PM2? What are the implementations? Why is it any different from running with the node command? A basic explanation would be appreciated.

1 Answers

PM2 is a process manager that enables you to have an easy way of managing and demonizing your application. Basically, it will run your Node.js application in the background as a service. PM2 helps you to facilitate product-level deployments, which require running applications alive indefinitely.

# To install PM2
npm install -g pm2

# To start the application
pm2 start app.js --name "test-application"

# To check the status
pm2 status

# To restart all applications
pm2 restart all

# To check logs
pm2 logs

pm2 status

pm2 logs

Related