Running a Node.js Server Forever

preview_player
Показать описание

Рекомендации по теме
Комментарии
Автор

I swear. Continue with these videos. You definitely have the best js tutorials out here. The world will soon find out.

Blacksoljah
Автор

A good alternative to this would be the pm2 module, I've used it a lot for running my Node JS programs 24/7 (not just web servers) for over a year now. It works pretty similarly, but I've had an easier time navigating its menu than with forever. Like forever, it runs everything even with the console closed, as well as restarting the application if an error occurs. If it's forced to shut down about 100 times in quick succession, it marks it as "errored" and stops running it until it's restarted. You can also start, restart, stop, and remove multiple processes at once. I don't use any, but there are more advanced options for the module. I personally just use these commands:

$ pm2 list - Lists processes
$ pm2 start - Starts process or processes (allows optional tags to determine things like if the application restarts whenever the index is updated)
$ pm2 stop - Stops process or processes by ID or name
$ pm2 restart - Restarts process or processes by ID or name
$ pm2 save - Saves processes to a dump file where it can be later accessed. This is useful for if your machine shuts down and you have to restart it
$ pm2 resurrect - Revives all processes from the dump file, if one of the processes is already running, it ignores that one

Jasmine-wbju
Автор

Stuff related to ''forever" starts at 6:47 and best video Kyle, Thx.

shankydoodle
Автор

finally something that worked. I did forever because the npm install nodemon -g did not worked and I am the owner of the folders

alejandrocano
Автор

Did this on my raspberrypi, wasn't exactly the same but close enough for me to figure it out, and get it working for me! Thanks Kyle Robinson Young!

Hasher
Автор

finally something simple without that app.services file I understand nothing from, I can finally run the server on my cloud VM

SKREFI
Автор

This tutorial really helped me a lot in my assignment trying to get the server run forever!! thank you so much!!

chara
Автор

It should be mention as well for nodemon for development. It will restart the node server if the js file has been updated

gianpaj
Автор

i've beeen searching for this for a while, it worked thanks

Ajaygg
Автор

This was absolutely great! Thank you so very much!

speccan
Автор

super bro. Nice keep making videos like these

indanasandeep
Автор

Waiting for a great tutorial with PM2 to manage Node.js processes!

atrakt
Автор

you hit the target that I needed. Now i need more :)

talmorkliman
Автор

Love your vids... You have the ability to make information bite-sized when others do not. One question though, why bears?

benmarbles
Автор

Great tool! It's save me so much time and effort!

pablolizardo
Автор

thank you so much! i love your videos!

JohnDev
Автор

Very sleek... I would like to know if the same startup script (bash or something) can be done for windows os? I am referring to the forever starting after the system boot.

nbaua
Автор

So when it runs while under 'digital ocean' is it 'considered' up and running and you are being billed for that up-time ?? As a hobbyist would this be the right way to go ?

df
Автор

Thank you great tutorial, very helpful!

catherinekim
Автор

Wow, how things have changed. io.js merged into nodejs and babel-node now lets me write import instead of require!

RobertBaindourov