Skip to content

Latest commit

 

History

History
 
 

express-with-nodemon-browsersync

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

Express with Nodemon & Browsersync

Functionality

Auto restart ExpressJS server and auto reload browser on file changes.

This setup uses file watchers when the server is started in development mode (see usage). If server files change (e.g. index.js), the server itself automatically restarts (using Nodemon). If browser files change (e.g. src/index.html or src/index.css) the browser automatically reloads (or injects) (using Browsersync). Interactions are also synced when multiple browser windows are connected.

Note: Automatic browser reloading only happens on the proxy http://localhost:9778, not the regular http://localhost:9777.

Usage

After installing dependencies using npm install the following scripts are available:

npm run ... Description
start Alias for start:dev.
start:dev Starts a development server on http://localhost:9777 ("xprs" in T9) and http://localhost:9778 with live reload and synced interaction.
start:prod Starts a production server on http://localhost:9777.

Development server

  • has caching disabled.
  • auto-restarts server on server file changes.
  • auto-reloads browser on browser file changes.

Production server

  • has caching enabled.
  • has dynamic Brotli and Gzip compression enabled.
  • has no auto-reload.

More resources