Is there a way for Nodejs to reflect the changes done in my files, rather than closing the node and running it again? I'm still in the development phase so I make a lot of changes, so what I do is I stop the server each time and run it again (with "node" command)
If it's just running (not a daemon) then just use Ctrl-C . Where PID is replaced by the number in the output of ps . You could also use "killall -2 node", which has the same effect. Don't want/need to kill all node processes.
Running non-Node code While Nodemon is running, we can manually restart our application. So instead of stopping and restarting Nodemon, we can just type rs and press enter, and Nodemon will restart the server or the running process for us.
This is a quick tip for using nodemon to monitor your JavaScript files for any change. While doing development on any NodeJS application, whenever we make any change to some file we need to restart our Node server from the command prompt/terminal.
nodemon is a command-line interface (CLI) utility developed by @rem that wraps your Node app, watches the file system, and automatically restarts the process.
I prefer to use https://github.com/remy/nodemon you can install it globally
npm install -g nodemon
and start your server by doing
nodemon app.js
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