Automatically Restart Your Node.js App Using Nodemon
We are learn restart node server automatically using nodemon. first of all install nodemon using npm i nodemon. nodemon use in very esay one time setup and while start node app.
In this tutorial, you see while developing your node.js app, When you change something in your code then you have to start the server to see it, that is, every time we change the code, so many times we have to start the server, to avoid this we use Nodemon. Nodemon is a CLI (command-line interface) utility that can wrap your node.js application. how to use Nodemon It can watch the files in your server folder and automatically restart your app when changes are detected.
You can install it locally for just your current application or even install it globally for all of your projects.
npm install nodemon -g
What is the benefit of installing Nodemon locally? It arrives in the developer's project by a command in the package.json file and can start whenever it wants on the developer read more.
npm install nodemon --save-dev
Nodemon can handle the same arguments passed to a Node script to restart node server. If your node.js or express setup is in a server.js or an index.js file, begin your application like you would with start node app.
Like running your script with Node how to restart an app, you can pass in arguments at the end.
I hope it can help you...
Leave a Reply