Running Node.js Forever

If we use node to run Node.js script, it will block the current shell until it crashes or is forced to exit with Ctrl-C. But sometimes we might need to run this service in background or manage the Node.js

The traditional way is to use nohup.

$ nohup node hello.js > output.log &

Or you can choose some libraries such as daemon.node. So, if we already has the way to run service in background, what’s the benefit of using Forever?
Continue reading

Advertisements

First Node.js Sample – Hello World

Yeah…it’s “Hello World” again.

You don’t really need to put your javascript in specify folder; so you can just create a new folder and put everything inside. Because I used nvm to install Node.js before, so I put my demo files inside ~/.nvm
Continue reading