koa静态服务器

Others 2018-07-19 02:52:05 2018-07-19 02:52:05 2292 次浏览
const Koa = require('koa')
const app = new Koa()
const  serve = require("koa-static");
const port=3001;
app.use(serve(__dirname+"/public",{ extensions: ['html']}));
app.listen(port);
console.log("服务端口"+port);
public 目录下作为静态资源根目录