oaijs / koa-oai-router

Koa Router, based on OpenAPI, Swagger and Json Schema.
105 stars 15 forks source link

Not getting parameter from path #31

Closed amunhoz closed 7 years ago

amunhoz commented 7 years ago

It looks like it's not parsing the parameter in path in any way. Example: in the route /user/{userId}, the userID value is not in request.query or request.param Could not find anywhere.

amazing-gao commented 7 years ago

Koa-oai-router depends on koa-router, you can find detail of URL parameters at here.

router.get('/:category/:title', function (ctx, next) {
  console.log(ctx.params);
  // => { category: 'programming', title: 'how-to-node' }
});