-
Notifications
You must be signed in to change notification settings - Fork 5
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
Provide a way to iterate over route handlers #8
Comments
Are there any other use cases for this that you could think of? For your use case I'd rather add a global mount point for the route... |
Do you have an example of doing this anywhere?
I'm working on an authentication package, which will modify paths of existing routes to "protect views", like is done with flask here |
The global mount point will get pushed soon - I think it has general applicability besides what we discuss here... So, optimally you would like a way to map over the paths, and reassign the result? |
yep |
are you thinking an interface where you provide a function that gets the method, path, and handler and then reassigns it itself, e.g. route$remap_handlers(function(method, path, handler) {
route$add_handler(method, paste0('/prefix', path), handler)
})
|
Yea, that looks good! |
It doesn't seem as though there is a way to iterate over all the handlers of a given route, which could be useful, for example, to add a prefix to every route path
The text was updated successfully, but these errors were encountered: