Bootcamp
Search…
📅
Course Schedule
0: Language and Tooling Teaching Guide
1: Frontend Basics Teaching Guide
2: Backend Basics Teaching Guide
3: Backend Applications Teaching Guide
4: Backend Structure Teaching Guide
5: Full-Stack Applications Teaching Guide
6: Frontend Infrastructure Teaching Guide
7: React Teaching Guide
8: Advanced React Teaching Guide
9: Advanced Topics Teaching Guide
🧮
Algorithms Teaching Guide
💼
Interview Prep Teaching Guide
☺
User Experience Teaching Guide
0.6: Nodemon

Introduction

​Nodemon is an application that restarts our server every time we change a file that the server depends on. This is especially useful in development when we are making regular changes to our server code.

Usage

  1. 1.
    Instead of running node index.js, which requires us to Ctrl+C and restart our server every time we make code changes, we can use Nodemon.
  2. 2.
    Install Nodemon globally to avoid stopping and starting our server every time our files change. This makes the command available globally on our system.
    1
    npm i -g nodemon
    Copied!
  3. 3.
    Running the following command to start our server will cause our server to restart each time we save a file it depends on. The -e js argument tells Nodemon to only restart on changes to JS files. By default Nodemon also "watches" (i.e. restart on changes) JSON files, which can be troublesome when we work with JSON files as DBs.
    1
    nodemon index.js -e js
    Copied!
  4. 4.
    Once we transition to SQL DBS, feel free to use nodemon without the -e argument.
Last modified 2mo ago
Copy link