Node.js has seen an important growth in past years and is still increasing its value in many organizations and business models. Companies like Walmart or PayPal have already started to adopt it.
NPM, the package manager of Node.js has been already installed when you install Node.js and is ready to run on your computer. Node.js doesn’t offer you the privilege of automatic restart like other languages such as PHP or Ruby. Whenever you make changes in your source code, you need to run the code again and again by using command.
Most of us are used to save the file in Editor and then hit [ctrl + c] (To stop application) & then restart by hitting again [UP arrow + Enter]. However rather than doing this repetitive task manually, we can certainly automate it and can make the process more easier by using some tools:
1. nodemin: Among all those tools, we would like to start with nodemon first. Basically, Nodemon is a utility that monitor for any changes in your source and automatically restart your server.
npm install nodemon -g
After installing the nodemon utility we will use the following command to run the code.
npm install supervisor -g
After installing the node-supervisor we will use the following command to run the code.
3. forever: The remaining tool so called forever is a node.js package that is used to keep server alive even when it crashes or stops because of some error/exception. Forever automatically restarts it.
npm install forever -g
frorever start filename.js
- Nodejs | Automatic restart NodeJs server with nodemon
- Refresh a page using PHP
- What’s the best way to reload / refresh an iframe?
- How to refresh a page using jQuery?
- Python program to reverse the content of a file and store it in another file
- How to get file input by selected file name without path using jQuery ?
- Nodejs | DNS
- Nodejs | Jimp
- Nodejs | DNS | setServers()
- Web-Socket in NodeJS
- Nodejs | GM quality() Function
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.