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
.
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 . |
- has caching disabled.
- auto-restarts server on server file changes.
- auto-reloads browser on browser file changes.
- has caching enabled.
- has dynamic Brotli and Gzip compression enabled.
- has no auto-reload.