Hey guys I am back with another blog post. In this post we will be discussing what is the difference between Node and Nodemon. Many young developers have this question in their mind and in the forums such as stackoverflow I have found this questions asked a lot by developers. So I decided to answer this question specifically by writing a complete blog post. Let’s start by discussing what is Node and Nodemon?
WHAT IS NODE ?
Create your own server in node so that it can responds to user requests at particular
You can use Node to interact with the User’s File System.
You can use node to make networking applications as there is a http module available.
WHAT IS NODEMON ?
Nodemon unlike Node is a package available in the Node Package Manager (NPM). It’s specific use is to automatically restart the node server without having to start the node server explicitly by typing the node commands. It greatly reduces the time and effort required by the developer in running the application.
So the Question Arises how to install nodemon into node application and how to use it for better results?
Make sure Node is installed into your computer. To check if it is installed there is a very simple command available to check it. The command is node –version. Just open the command prompt on the computer and type this command. You will see the version of node which is installed if the command is successful. If error comes then node is not installed so just go to it’s official website and download the latest version of Node.
MAKE NEW NODE PROJECT
RUNNING NODE APPLICATION
After writing all the code in the server.js file. You want to run this file. To run it simply open the termional and type node server.
OPEN APPLICATION IN BROWSER
Just open the application at the port number you have mentioned in the browser. The address will be localhost:8080
DOWNLOAD NODEMON PACKAGE
After running the application we need to install the nodemon package so that you don’t need to stop the server everytime you make a change in the application. It should automatically do that for you. For that you should be installing nodemon. We will be installing nodemon with this command globally into the system. The command to install nodemon is npm install -g nodemon . Type it in the terminal and wait for some time.
After installing nodemon globally into the system. It’s time to get started with the application so just first of all stop the server by pressing ctrl+c and then enter the command nodemon server to start nodemon. You will see the following screenshot if your command is successful.
Now you have successfully configured nodemon into our application. So now everytime you make any kind of changes into your application then automatically those changes will be reflected back onto the browser without having to explicitly stop the server and then restart it to make the changes.
This is the end of the post and you have successfully understood what is the difference between node and nodemon and also you have implemented nodemon into your application. Thank you very much for reading this post and also please subscribe to our newsletter for receiving more posts like this.
A programmer scientist by the mind and a passionate blogger by heart ❤️. Fountainhead of Coding Shiksha Life motto: Live while you can! Teach & inspire while you could & Smile while you have the teeth.Gautam Sharma