Restarting your HTTP server and refreshing your browser is annoying.
Reload works in two different ways depending on if you’re using it:
- In an existing Express application in which it creates a server side route for reload or,
- As a command line tool which starts its own Express application to monitor the file you’re editing for changes and to serve
reload-client.jsto the browser.
Once reload-server and reload-client are connected, the client side code opens a WebSocket to the server and waits for the WebSocket to close, once it closes, reload waits for the server to come back up (waiting for a socket on open event), once the socket opens we reload the page.
Using reload as a command line application
npm install reload -g