26th DEC 2018
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?
Create your own server in node so that it can responds to user requests at particular ports. 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.
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.
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.
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.
Just open the application at the port number you have mentioned in the browser. The address will be localhost:8080
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.
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.
Developer, Tech. Evangalist.