Koa-router cannot yield when handling post requests?

  node.js, question

I wrote such a code

var app = require('koa')();
 var router = require('koa-router')();
 var body = require('koa-body')();
 
 app.use(router.routes());
 router.all('/login',body,function* (next){
 let data = yield next;
 this.body = data;
 });
 router.all('/login',body,function*(){
 return {code:1};
 });

Where’ /login’ is an asynchronous post request, the problem now is that when let data = yield next is added; After that, it was impossible to transfer to the next iteration function. The program got stuck in this sentence. During this period, the program did not report any errors, resulting in the timeout of asynchronous post request. Has anyone encountered this problem?

No one had to answer it himself.
I just saw koa-router athttps://github.com/alexmingoi …According to the above description, it is found that if many iteration functions need to be executed for the same request, the official recommended method is to use a similar method.router.all('/login',body,function*(next){yield next},function* (){},.......);In this way, the problem is solved.