-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Passing explicit path to middleware instance #36
Comments
@idanto I could work on this if you think that it makes sense. |
@kibertoad sure, I would love to add this feature to the package. |
@idanto But current way is middleware per-route already; why can't user simply comment out or delete middleware for that particular route? |
right, haven't thought about it like that. It was more like reading specific routes from the swagger file and not all of them but it's less critical. feel free to go ahead with just your use case. |
Currently middleware itself is responsible for determining path that is currently being accessed (
let path = req.baseUrl.concat(req.route.path);
). It would be helpful to be able to attach middleware to specific endpoints with predefined swagger path already filled during instantiation.This is useful for Google Cloud Functions: while they seem to use Express under the hood and in general support swagger-style middleware, you can't attach middleware on app or router level and you don't have access to routing params, making usage of express-ajv-swagger-validation impossible.
Basically API could look like this:
The text was updated successfully, but these errors were encountered: