If you are working with node.JS, you may experience the need to restart the node server as soon as a file has changed.
There are plenty approaches for this field. One is, to parse for all require statements in the code and watch those files then.
I took a different approach, which could be described by this linux command:
It searches for all .js files in the folder and restarts the server, as soon as one of those changed. Very easy, but yet powerful.
To use it, just copy:
rundevserver.js into your server directory.
This script expects your server script to be called run_server.js. If you want to change it, just change the line.
Instead of running your server with
you now start it with:
That's it!
This feature is of course part of the
spludo framework's 1.0-dev version. In spludo, you can use
$ bash run_dev_server.bash
instead of
to achieve a hot reload on each .js change.
Update 2010/08/27: Wilkerlucio created a version for hot reloading coffee-scripts.