How to deploy an application in local Nodejs?

Asked

Viewed 1,137 times

-1

Talk personal, all right ? I’ve been searching the web but I got confused , I’m new to programming in Ode I made an application but I don’t know how to make the local deploy as a service for example. Where can I start ? It is possible to do this ?

Thank you for your help.

1 answer

0

I usually use the pm2 to run the server as a service type. It is quite simple to use.

npm install pm2@latest -g

To use if it is at the root of the project, where the 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 so just monitor the status pm2 status

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

Usually I carry one 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/restarts it again. In his documentation he explains everything.

Reference: PM2

Browser other questions tagged

You are not signed in. Login or sign up in order to post.