Why below code output as 'one', not 'one' 'two'? but using express-route is ok
app.use(route.get('/admin',requiredUser,index));
function *requiredUser(next){
console.log("one"); //required session
yield next;
}
function *index(next) {
console.log("two"); //ok save login
this.body = yield render('admin');
}
koa-route only takes one handler - whatever you give its 2nd argument. That's why it's only executing your first handler.
You can use https://github.com/koajs/compose to combine an array of handlers into one:
Or you can use another routing library like https://github.com/alexmingoia/koa-router which has the behavior that you originally expected from koa-route: