i have a simple js file with http module to test Hello node
for nodejs....
below is the http_test.js
file
var http = require('http');
http.createServer(function(req, res) {
res.writeHead(200);
res.end('hello node');
}).listen(8080);
node http_test.js
prints fine on the browser...now if i change my response line to say res.end('changed hello node to hello stoner');
, i still get previous hello node
on my page....
to get the changed line i got to end the current instance of node and then again run
node http_test.js
if i make any changes to js file should i restart over?
wouldnt just hitting refresh on my browser do it?
1) Install nodemon. To install, from your terminal run:
npm install -g nodemon
2) Now, go to terminal, where you have the program. And, run
nodemon http_test.js
Now, everytime when you make changes to your app, just save your changes and it will get reflected.
Details :-
Nodemon is a utility that will monitor for any changes in your source and automatically restart your server. Perfect for development. Install it using npm.
Just use nodemon instead of node to run your code, and now your process will automatically restart when your code changes.
Please refer :-
http://nodemon.io/
https://github.com/remy/nodemon
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With