With Node you can write very fast JavaScript programs serverside. It's pretty easy to install Node, code your program, and run it. But > how do you make it run nicely in the background like a true server?
- Go to
/etc/init/
$ sudo vim yourapp.conf
- Paste script.conf
$ sudo start yourapp
- And when you wanna kill the process
$ sudo stop yourapp
Thanks to [kvz.io] (http://kvz.io/blog/2009/12/15/run-nodejs-as-a-service-on-ubuntu-karmic/) for this!
I did it by pm2 this way(Ubuntu 16.04.01 LTS):
npm install -g pm2
pm2 start yourapp.js
pm2 startup
pm2 save