egg icon indicating copy to clipboard operation
egg copied to clipboard

路由命中多个app.router.get对应controller间怎样交互

Open fuufuuf opened this issue 8 years ago • 2 comments

  • Node Version:
  • Egg Version:
  • Plugin Name:
  • Plugin Version:
  • Platform:
  • Mini Showcase Repository:

如果一个请求/test, 命中多个router app.router.get('/*', c1) and app.router.get('/test', c2), 由于controller对应方法没有next参数,无法await next(), 导致c1和c2之间无法交互。请问是这样的么

fuufuuf avatar May 05 '18 16:05 fuufuuf

Translation of this issue:


Route Hit Multiple App.Router.get Correspondences Between Controllers

  • Node Version:
  • Egg Version:
  • Plugin Name:
  • Plugin Version:
  • Platform:
  • Mini Showcase Repository:

If a request /test hits more than one router app.router.get('/*', c1) and app.router.get('/test', c2), since the controller corresponding method does not have a next parameter, it cannot await next ( ), resulting in no interaction between c1 and c2. Is this the case?

egg-bot avatar May 05 '18 16:05 egg-bot

Yes, only one route will be matched, You need write a middleware.

popomore avatar May 05 '18 17:05 popomore