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
- How to refresh a page using jQuery?
- What’s the best way to reload / refresh an iframe?
- How to refresh parent page on closing a popup ?
- Nodejs - Connect MongoDB with Node app using MongooseJS
- Cowsay in Nodejs using Requests library
- Nodejs | Web Crawling using Cheerio
- Web-Socket in NodeJS
- Signup Form Using Nodejs and MongoDB
- Dockerizing a simple Nodejs app
- Nodejs | DNS
- Encrypting Data in NodeJS
- Difference between NodeJS and AngularJS
- Nodejs | Jimp
- Nodejs – Connect Mysql with Node app
- Nodejs | DNS | setServers()
- NodeJS | Building simple REST API in express
- NodeJs - Handling invalid routes
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. 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.