Automatic Reloading Using Nodemon
Nodemon is an open-source utility tool that helps automatically restart a Node server whenever a change in code is detected in development. In this lesson, we'll install Nodemon and introduce an application script that will start the Node server with Nodemon.
📝 This lesson's quiz can be found - here. 🗒️ Solutions for this lesson's quiz can be found - here.
When developing our server application, there are going to be a lot of changes we're going to make to our code. We probably don't want to stop our running server and restart it every single time we make an update. Wouldn't it be nice if there was a third-party tool that did that for us? Well, there is, and it's called Nodemon!
Nodemon is a tool that will monitor for any changes in our source code and automatically restart our Node server when a change is detected. To install Nodemon, we'll run the
npm install command but this time use the
-D flag which is a shorthand version of
--save-dev. This indicates that the package to be installed is a development dependency. Development dependencies are packages that are only needed for local development.