The essential tutorial for Nodemon, a utility for Node.js applications that monitors for changes and automatically restarts the server.

In development environments, especially those that involve lots of iterations, we do not want to restart our server or backend app manually when we make changes to our source code.

This is an issue that Nodemon solves. It acts as a utility library for keeping track of server changes and automatically restarts our app for us.

According to the documentation, Nodemon is a perfect tool for development in Node.js-based applications. Indeed, it was built with the properties of the Node’s CLI command in mind, since it is a wrapper around the node command.

Basically, it works by detecting changes in the current directory of our source code, and restarts the server to cater to these new changes.

Recall that in order to run a Node.js app, we begin with the node command and append the file name. In development with Nodemon, all we need to do is run Nodemon filename, and Nodemon will watch our files for us.

However, to make use of Nodemon, we need to install it globally on our machines or locally on a per-project basis.

When installed on a per-project basis, all we need to do is update the script tag in the package.json file of our project. To use Nodemon in development mode, we can add a "dev": "nodemon app.js" line to the script tag in the same file.

When installed globally, Nodemon is available on our system path and works out of the box.

In this tutorial, I will explain how Nodemon works by exploring its features and how they are being used.

We will cover the following:

  • What is Nodemon?
  • Installing Nodemon both locally and globally
  • Nodemon configurations and usage
  • Nodemon’s features

In order to follow along with this tutorial, readers should have a basic understanding of Node.js and Express.

#node #web-development

How to Automate Restart Node.js Apps with Nodemon
14.00 GEEK