i have setup the node project on the AWS EC@ instance.
npm start
is working. then project running on the 3000 port. but it will closing when close the terminal. then i have tried PM2.but when run using PM2 its not working. but status showing as online.
these are the command used to run PM2,
npm install pm2 -g pm2 start app.js pm2 startup pm2 save
why is that ? how can i run it?
have you tried pm2 logs
?
Also, you can set the project for default like whenever you want to run your server you can simply run by using the pm2 logs
command, to set up your server here is the command
Go to your source folder or where your app.js file is stored, and then run this command
pm2 start npm --name "Your Project Name" -- run start
After setting up by this, you can always run your server with pm2 logs
command
Thanks