browsermon
v1.0.2
Published
Automatically reload browser when nodemon restarts http server during development
Downloads
39
Maintainers
Readme
browsermon
Automatically reloads the browser whenever server restarts. No need to manually refresh the page when the server restarts.
Useful while working with nodemon or similar packages during development.
Installation
# yarn
yarn add browsermon
# npm
npm install browsermon
Usage
Server
http server example:
const http = require("http");
const browsermon = require("browsermon");
const server = http.createServer((req, res) => {
// handle requests
});
// pass in server
browsermon({ server });
express example:
const express = require("express");
const browsermon = require("browsermon");
const app = express();
// express handlers
const server = app.listen(PORT);
// pass in the server
browsermon({ server });
Client
<html>
<head>
<!-- Add script to html pages to reload when server restarts -->
<script src="/browsermon/browser.js"></script>
</head>
</html>