标签:html name exp 检查 fun stat list 命令 text
app.js
var exppress = require("express");
const fs = require("fs");
var app = exppress();
app.use(exppress.static("dist"));
const port = 3000;
app.listen(port, () => {
console.log(`服务已经启动 at http://localhost:${port}`);
});
//服务端端路由
app.use(function (req, res, next) {
//每次返回index.html
fs.readFile(__dirname + "/dist/index.html", function (err, data) {
if (err) {
console.log(err);
res.send("后台错误");
} else {
res.writeHead(200, {
"Content-type": "text/html",
Connection: "keep-alive",
});
res.end(data);
}
});
});
标签:html name exp 检查 fun stat list 命令 text
原文地址:https://www.cnblogs.com/heihei-haha/p/14888684.html