Nodemon reload the server on code change automatically
In this post we will give you information about Nodemon reload the server on code change automatically. Hear we will give you detail about Nodemon reload the server on code change automaticallyAnd how to use it also give you demo for it if it is necessary.
In this tutorial, I will tell you what is the use of nodemon and where you can use it.
Using Nodemon, you do not need to restart your server on any changes made in your source code because this will monitor for any changes in your code and restart your server automatically.
When you want your process will restart automatically on any changes then you must use nodemon
instead of node to run your application.
.
Install nodemon globally
Run following line of code to install nodemon :
sudo npm install -g nodemon
By running above command, nodemon will be installed globally to your system.
Usage
By using node, you run your application like this :
node server.js
By using nodemon, you will run your application like this :
nodemon server.js
It supports coffee-script apps:
nodemon server.coffee
Nodemon watch the files in the directory in which nodemon was started,Whenever any files get changed then it will restart the node application automatically.
Default Extension supported by nodemon
By default it look for files with the .js
, .json
, .coffee
, .litcoffee
extensions.
You can define your own list by following way :
nodemon -e js,jade
Now nodemon will look for files with the .js, .jade extensions.
There might be some case where you need to ignore some specific files and directory.You can ignore files and directory by following way :
nodemon server.js --ignore lib/
It is open source and requirable in node apps.
Hope this code and post will helped you for implement Nodemon reload the server on code change automatically. if you need any help or any feedback give it in comment section or you have good idea about this post you can give it comment section. Your comment will help us for help you more and improve us. we will give you this type of more interesting post in featured also so, For more interesting post and code Keep reading our blogs