const { createServer } = require("http");
// π Polyfill `module.hot`
require("hot-module")();
if (module.hot) {
// π Watch `./app` for changes
module.hot.accept("./app", function() {
console.log("π Hot-reloaded `./app`");
});
console.info("β
Server-side HMR Enabled!");
} else {
console.info("β Server-side HMR Not Supported.");
}
createServer((req, res) => {
// π Always reference latest `./app` between requests
require("./app")(req, res);
}).listen(3000, () => {
console.log("π Listening at http://localhost:3000");
});