下载页
-
页面
-
目录
-
代码【index.js】
const koa = require('koa'); const fs = require('fs'); const mount = require('koa-mount'); const static = require('koa-static'); const app = new koa(); // 开放静态目录 app.use( static(__dirname + '/source/') ); app.use( mount('/', async (ctx) => { ctx.body = fs.readFileSync(__dirname + '/source/index.htm', 'utf-8') }) ); app.listen(4000); // module.exports = app;