BibbyChung / express-hot-reload-dev

hot reload for express (hmr). help you develop without server restart.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

express-hot-reload-dev Build Status npm

hot reload for express

how to use

demo 0 | demo 1

import exp from 'express';
import { hotReload } from 'express-hot-reload-dev';

const app = exp();

const hotReloadMiddle = hotReload(`${__dirname}`, false);

const routePaths = [
  '/routes/router01'
];

for (const item of routePaths) {
  const routePath = `${__dirname}${item}`;
  app.use(hotReloadMiddle(routePath));
}

app.listen(3000, ()=>{
  console.log('Listening on 3000');
}); 

workspace

docker run --rm -it \
  -w /app \
  -v $(pwd):/app \
  -p 9000:9000 \
  node:12.14-alpine /bin/sh

run test

npm i
npm run test

references

other issues

About

hot reload for express (hmr). help you develop without server restart.

License:MIT License


Languages

Language:TypeScript 96.4%Language:Shell 3.0%Language:Makefile 0.5%