I am using express and every time I make a change to my controller, I need to restart the HTTP server, which is somewhat inconvenient. Is there a "watch" command or an equivalent in express or Node.js that watches for changes and restarts the server automatically?
Try nodemon, it will restart your application every time you made a change
To watch files for changes, you could use fs.watch()
or fs.watchFile()
. However, daemon modules such as supervisor or nodemon exist for your purpose.
I use node-dev for automatic restart on source code change.