Setup a development mode in LoopBack API using nodemon

Bram Borggreve
InstructorBram Borggreve
Share this video with your friends

Social Share Links

Send Tweet
Published 7 years ago
Updated 5 years ago

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.

[00:00] 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.

[00:12] 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.

[00:20] 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.

egghead
egghead
~ an hour ago

Member comments are a way for members to communicate, interact, and ask questions about a lesson.

The instructor or someone from the community might respond to your question Here are a few basic guidelines to commenting on egghead.io

Be on-Topic

Comments are for discussing a lesson. If you're having a general issue with the website functionality, please contact us at support@egghead.io.

Avoid meta-discussion

  • This was great!
  • This was horrible!
  • I didn't like this because it didn't match my skill level.
  • +1 It will likely be deleted as spam.

Code Problems?

Should be accompanied by code! Codesandbox or Stackblitz provide a way to share code and discuss it in context

Details and Context

Vague question? Vague answer. Any details and context you can provide will lure more interesting answers!

Markdown supported.
Become a member to join the discussionEnroll Today