为什么我不能在第二个中间件中使用 async 和 await?

问题描述

我在 koa-router 官方文档中找到了一个演示。

router.get(
  '/users/:id',(ctx,next) => {
    //something
  },async ctx => {
    //I can't use await here
  }
);

但是为什么我不能在第二个中间件中使用 async 和 await 呢?认情况下,我总是收到 Not found 响应。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)