Untitled

mail@pastecode.io avatar
unknown
javascript
a month ago
562 B
1
Indexable
Never
//Livereload/refresh any ejs render file in browser automatically
//Step:1>> npm i -D livereload connect-livereload
//Step:2 >> In app.js insert below code after declare and define app and port of expressjs

const livereload = require("livereload");
const connectLiveReload = require("connect-livereload");
const liveReloadServer = livereload.createServer();
liveReloadServer.watch(path.join(__dirname, "views"));
liveReloadServer.server.once("connection", () => {
	setTimeout(() => {
		liveReloadServer.refresh("/");
	}, 100);
});
app.use(connectLiveReload());
Leave a Comment