Watching for Node file changes
When developing Node-based applications, we start the node process by running either node <filename> or executing a specific start script. During development, we will be making frequent changes to the source code files. These changes will not be automatically reflected in the running Node application. The source code files are stored in memory (Resident Set -> Code Segment), and we need to restart the Node process every time the changes are made. Frequent killing of process can be automated by using various tools.
Lets take a look at using one of these tools “nodemon”.
Create a sample Nodejs application (server.js) as shown below:
var http = require(‘http’);
var port = process.env.port || 1337;
http.createServer(function (req, res) {
res.writeHead(200, { ‘Content-Type’: ‘text/plain’ });
res.end(‘Hello World\n’);
}).listen(port);
Install nodemon globally:
npm install -g nodemon
Run the node application:
nodemon server.js
This should launch the node process listening at port 1337

Make changes to server.js. For eg: change the response to : “Hello World Modified”. You should see the node process restarted by nodemon and GET request now returning the new response string.

Tools
Apart from nodemon , there are other tools as well which serve similar purpose.