我用express设置了一些静态资源
import * as express from "express";
const app = express();
const port = 3000;
app.use(express.static("./static"));
app.listen(port, () => {
console.log(`listening at http://localhost:${port}`);
});
静态目录中有一个index.html文件。我想在更改index.html后重新启动express并刷新浏览器
我试过nodemon但不是我想要的
1条答案
按热度按时间kqlmhetl1#
安装
livereload
及connect-livereload
```import * as express from "express";
import * as livereload from "livereload";
import * as connectLivereload from "connect-livereload";
const app = express();
const port = 3000;
const staticpath = "./static";
const liveReloadServer = livereload.createServer();
liveReloadServer.watch(staticpath);
app.use(connectLivereload());
app.use(express.static(staticpath));
app.listen(port, () => {
console.log(
listening at http://localhost:${port}
);});