A
A
Albert Kazan2018-03-23 09:15:39
Node.js
Albert Kazan, 2018-03-23 09:15:39

How to start nodejs server?

Relatively recently I started writing for nodejs.
I start the server through the console. How does it work in production for you? Does someone monitor the script all the time and restart it via the console?!
It seems at the same time it still often crashes due to errors.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
O
OnYourLips, 2018-03-23
@OnYourLips

For production, you need to write a systemd unit.
https://www.digitalocean.com/community/tutorials/h...

D
Dmitry Belyaev, 2018-03-23
@bingo347

pm2

A
Abcdefgk, 2018-03-23
@Abcdefgk

Yes, just everything.
Set npm install -g forever
Allow it to run Node scripts - apt-get install nodejs-legacy
Run from the application directory: forever start server.js
(everything is a little more complicated, but for starters and general understanding it will start like this)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question