1.先下载
npm install koa-static --save
2.引入
const staticFiles = require('koa-static');
const Koa = require('koa');
const app = new Koa();
app.use(staticFiles(__dirname + '/')); //静态目录
npm install koa-static --save
const staticFiles = require('koa-static');
const Koa = require('koa');
const app = new Koa();
app.use(staticFiles(__dirname + '/')); //静态目录
本文标题:koa设置静态目录
本文链接:https://www.haomeiwen.com/subject/ibspactx.html
网友评论