请问老师的koa-generator 是什么版本的,我这里跟老师写了一样的中间键,还是在使用的时候报错:app.use() requires a generator function,说use需要的是一个generator 函数
//pv.js
function pv (ctx) {
global.console.log(ctx.path)
}
module.exports = function () {
return async function (ctx,next) {
pv(ctx)
await next()
}
}
//app.js
const pv = require('./middleWare/pv')
....
app.use(pv());
