1、安装
cnpm i koa-ejs -D
2、使用demo
const Koa = require('koa');
const ejs = require('koa-ejs');
const path = require('path');
const server = new Koa();
server.listen(8080);
ejs(server,{
root:path.resolve(__dirname,'template'),
layout: false,
viewExt:'ejs',
cache:false,
debug:false
});
server.use(async ctx=>{
await ctx.render('1',{
arr:[12,34,66,88,99]
})
})