Closed kbrandwijk closed 8 years ago
The route definition ({ method: .., path: .., validate:.. etc}
) is not currently exposed to the middleware/handler but seems like a good idea. Ideally we add this to ctx.state.route
.
Care to open a PR? We should also clone the passed in definition so any middleware modifications to the definition at runtime don't cause weird side effects.
I can probably whip up a PR for it, although I'm not really sure how the cloning part fits in. Do we want the original definition exposed on the ctx, or do we want the actual runtime, possibly modified, one?
released in 3.1.0
I would like to use my own middleware on the routes. I know how to define it from the documentation, and the middleware is hit, but I would like to access the current route definition in it. Similar to how joi-router adds the validate property to the route definition, I would like to add my own (roles). How can I access the current route definition from my middleware?