/web-107-node-server

Develop with an automatic server refresh

Primary LanguageJavaScript

Web 107 Node Server

Nodemon is an actively maintained project that will reload our server for us automatically on file changes.

You can use nodemon in a couple of ways. You can install the tool globally or just for a single project.

Use Globally

# let's make sure we are on the latest version of npm
npm install -g npm

# install nodemon
npm install -g nodemon

Usage

cd to your project root directory and run the command below.

nodemon server.js

Use for a Single Project

Start from this GitHub repo as a template.

cd project-dir
git clone https://github.com/njmaeff/web-107-node-server.git .

Install

npm install

Commands

# starting the server in reload mode
npm run serve

# bonus using browser-sync to refresh the browser automatically
# install browser-sync
npm install -D browser-sync
# run the script
npm run sync