Nodemon — The little thing that makes Big things happen
“Edit, save, restart!!!”
As simple as this words sound or might look consumes a lot of time. When you accumulate the total amount of time you spend doing this minute task, it negatively affect your productivity. Time that can be better spent being productive.
For a developer, this can become tedious and monotonous so much so that it can lead to burn out.
Along comes Nodemon, a Node.js utitlty application that watches your application directory for changes and automatically reload the server. During testing, Nodemon becomes even more important.
Setting Up Nodemon
You can setup Nodemon using Npm or Yarn package managers. If you are using Npm, use the following command to install nodemon as a dev-dependency.
$ npm install nodemon -save-dev
If you are using a yarn package manager, you should enter
$ yarn add nodemon -dev
Next, you should change the settings in your package.json file to tell nodemon to take over file watching duties when you run your server.
add the following script to your package.json file.
“start”: ”nodemon — exec node ./server.js”
This enables nodemon run the command
node server.js automatically
To run your app now that nodemon watches your app directory for changes, enter npm run start.
To stop the nodemon process, press
Ctrl + C.