koa 路由问题
发布于 11 年前 作者 demohi 5476 次预览 最后一次回复是 11 年前 来自 问答
var mount = require('koa-mount');
module.exports = function(app){
return function * routes(next){
function *ab (next){
this.body = 'hello Hello';
yield next;
}
app.use(mount('/hello',ab));
yield next;
}
};
app.use(routes(app));
请教一下 这样写路由,为什么不生效呢。
2 回复
@JacksonTian 感谢回复 这样是可以,就是没法当成中间件来用了。