与koa路由器的多个中间件:“yield next”或“yield * next”?
有了koa-router
,在实现多个中间件的时候 ,为什么我不能yield* next
,而只是yield next
, next
是发生器呢?
koa
似乎在使用co
, 经过一番捣乱之后 ,似乎是感谢了,但是谁能证实呢?
yield* next
使用yield* next
有什么缺点,即使yield next
就足够了? 我觉得它不太容易出错(至less对未来的开发者来说)。
可以帮助(虽然我没有完全得到发生的事情):
- https://github.com/alexmingoia/koa-router/blob/5.x/lib/router.js#L327
- https://github.com/alexmingoia/koa-router/blob/5.x/lib/router.js#L336