Update Code Without Restarting Node Server

Do you hate to restart Node Server every time you change the code. I hate to restart my Server every time i change the code and that really slows down my productivity and some time it irritates too.

i have found a quick solution to fix this thing. Guy named Remy Sharp developed node module called as “nodemon”. This module helps to automatically restart your Server once you made the changes in Source code. Pretty cool.

Install Nodemon:

Installation is similar to other modules. But i prefer to install it globally in my System. Install nodemon by typing

npm install -g nodemon

You may need Sudo access in case of Linux or Mac based System.

How to use Nodemon:

To restart Node Server program we do this by using

node Server_file.js

but now you have to this using

nodemon Server_file.js

Nodemon will deal with starting it on Specific port and handling code updates.


To show you a demo i have created on simple Node app which returns ‘Hello world’. Now i have started the file with nodemon and now if i make changes in my source code in editor and save the file it automatically restart the server for me. See below for screen shot.

Before making changes


After making changes:

As soon as i make change in source code and restart it, nodemon detects the changes and Restart the Server.


Restart manually without stopping Nodemon

If in case you want to restart nodemon without killing it and starting again. You can do this by typing rs on terminal and press enter. That’s it.

Manipulating Restart time:

Nodemon keeps on check whether the source changed or not and of course it does it by using some timer. By default the time is 1 second but if you want to change that too for obvious reason. You can do so by using following command.

nodemon --delay 10 server.js

You can specify time in milliseconds or seconds.


Nodemon is very useful in development stage. It really pains to stop the Server and restart it again, nodemon really gives us very peaceful solution. The source code is free and tested by many developers so don’t worry about its security or memory eating issue. I personally gonna start using it and Codeforgeek recommend this.

9 thoughts on “Update Code Without Restarting Node Server”

  1. swarnendu dutta

    That was great..
    I have just started with node and was finding it frustating to restart the server each time i update code.
    I knew for sure that something is out there to sort this thing.
    Thanks a lot for putting this up really nice and easy 🙂

  2. What if you are in middle of writing code. even if we give pause for few minutes will it try to restart server with incomplete module. If yes doesn’t it looks frustuating if we seeing error in terminal while we coding in another window???

  3. > Update Code Without Restarting Node Server
    > nodemon detects the changes and Restart the Server.

    We still have restart. Better header is Update Code Without Manual Restarting Node Server.
    I’m seeking real solution w/o restart, because restart is very expensive (webpack build very long).

Comments are closed.