DEV Community

Cover image for Day 19 – Nodemon - Learning Node JS In 30 Days [Mini series]
Muhammad Ali (Nerdjfpb)
Muhammad Ali (Nerdjfpb)

Posted on

Day 19 – Nodemon - Learning Node JS In 30 Days [Mini series]

Up until now we've faced an issue. Did you noticed it already ?

Every-time we change some part of our code and we had to re-run again right ? Isn't it tiring ?

We can easily end this re-run process by using a package call nodemon. So how to use this nodemon ?

Check out the docs first about the nodemon. https://www.npmjs.com/package/nodemon

npm install -g nodemon will installed nodemon, but what is the -g ? Up until now we never saw something like this right ? -g means global. Installing globally means we can use this package from any npm project.

There is two way we can now use the nodemon. Easiest one is - just simply write nodemon in the console and it will start the server.

Alt Text

Nodemon is smart enough to point app.js when you just call it using nodemon, you can write nodemon app.js too.

The second way to use script on the package.json file. We are making a start script using nodemon.

Alt Text

Now write npm start in console and we're getting the exact same thing like before.

Alt Text

Now we can change anything and save it, nodemon will automatically restart the server for us with new changes. So are you going to use nodemon ?

You can see the graphical version here

Originally it published on nerdjfpbblog. You can connect with me in twitter or linkedin !

You can read the old posts from this series (below)

Top comments (0)