How to keep node server running in background

When you work with node js with a local environment you can keep your server active with the npm start command and access API.

but when you have to make your project live you may want all APIs should work continuously and perform all job backgrounds.

You can achieve this by PM2

you need to install pm2 and run this command

pm2 start npm -- start

if you want have name for better recongnization you can write unique name by follwing command 

pm2 start npm --name "app name" -- start

he app name will be unique name for you server

 

Share this post

Leave a Reply

Your email address will not be published. Required fields are marked *