If you’re coming from interpreter based server side languages like me, during development you develop this habit of seeing your changes instantly without compiling. The way Node.js works is,  the code gets compiled to native machine code. This is done at run-time by the engine, and it is continuously compiled to further optimize the code. It is not interpreted like many people believe. This means whenever you change your server side JS you’d need to restart the application.

Fortunately, there is a nifty little package that makes your dev workflow more efficient by doing this for you automatically. This package is called nodemon. It will watch the files in the directory in which your app was started, and if any files change, your app will be restarted.

nodemon does not require any changes to your code or method of development. It simply wraps your node application and keeps an eye on any files that have changed. Remember that nodemon is a replacement wrapper for node, think of it as replacing the word “node” on the command line when you run your script.

Nodemon on Github

Installation steps

npm install -g nodemon

Installing nodemon globally if you’ve npm setup already

How to Use

nodemon [your node app]

nodemon wraps your application, so you can pass all the arguments you would normally pass to your app.

Example when running