Nodemon in Node.js
Updated: Nov 3, 2022
Nodemon is a very powerful and useful tool. Every time we make changes in our node.js program, we need to save it and then run it again in order to get the updated code running. This increases steps in our workflow. Developers and programmers spend most of their time in programming and testing every change. So, they must get familiar with tools that speed up their workflow, nodemon in node.js being such a tool. Let us now learn about it.
WHAT IS NODEMON?
Nodemon is a tool or a module that helps in developing node.js based applications by automatically restarting the node application when file changes are detected in the directory.
Some of the features of nodemon are -
It does not require any additional change in our program code for execution.
It wraps our application. So, we can pass all the arguments that we would have passed for a simple application.
INSTALLATION
There are two ways of installing nodemon in our system.
One - cloning through GitHub repository
Two - by using npm, which is recommended by the official documentation of nodemon.
So, we will only be discussing the second method - using npm.
To install nodemon globally
npm i -g nodemon
Where i stands for install and g stands for global
To install nodemon as development dependency
npm install –save–dev nodemon
NOTE: With local installation, nodemon will not be available in our system path. This means we cannot use nodemon directly from the command line. In the local installation, we have to use nodemon with npm or npx.
Now, sit back and relax. For nodemon to start working, we don’t have to do anything more. We only have to write code, install nodemon and start the server. All the changes made will be automatically executed by nodemon.
Hope we now know about the nodemon module.
Thank you
Comments