How to deploy an application in local NodeJS?

0

Speak, all right? I've been searching the web but I was confused, I'm new to programming in node I made an application but I do not know how to do the local deploy as a service for example. Where can I start? is it possible to do that ?

Thanks for the help right away.

    
asked by anonymous 21.07.2018 / 01:15

1 answer

0

I usually use pm2 to run the server as a service type. It's very simple to use.

npm install pm2@latest -g

To use if it is in the project root, where index.js , mains.js or server.js :

pm2 start index.js

To stop is pm2 stop index or pm2 stop <nome da instancia>

After the start it releases the console, just monitor the status pm2 status

The logs pm2 logs and for more information pm2 show <nome da instancia> or pm2 show index .

I usually load a script.json containing various information such as environment variables, instance name, etc. There are also some commands to save the instance of pm2 and every time the computer or server starts / reinitializes it again. In his documentation he explains everything right.

  

Reference: PM2

    
21.07.2018 / 02:42