Join egghead, unlock knowledge.

Want more egghead?

This lesson is for members. Join us? Get access to all 3,000+ tutorials + a community with expert developers around the world.

Unlock This Lesson
Become a member
to unlock all features

Level Up!

Access all courses & lessons on egghead today and lock-in your price for life.


    Setup a development mode in LoopBack API using nodemon


    In this lesson we will learn to create a development mode for our server. We do this by installing nodemon as a dev dependency and creating a script tag called 'dev'.

    This script tag will execute the command nodemon server/server.js --watch common --watch server.

    We can execute this command by running npm run dev.

    When running in development mode the server will be automatically restarted when there are changes detected in the common and server directories.



    Become a Member to view code

    You must be a Pro Member to view code

    Access all courses and lessons, track your progress, gain confidence and expertise.

    Become a Member
    and unlock code for this lesson
    orLog In




    Let's add a development mode to our Loopback project. We install nodemon as a devDependency, and when the installation is finished, we open up our package.json. Inside the scripts section, we add a dev key, and as a value, we enter this string.

    This will watch the common and server folders, and restart the Loopback server when it detects changes. This saves us from manually restarting the server all the time.

    We start the server by running npm run dev, and open a second terminal window. While we edit one of the source files, we see that the server restarts automatically.