Skip to content
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

Make it easier to extend/subclass default router #2219

Open
vytas7 opened this issue Mar 25, 2024 · 0 comments
Open

Make it easier to extend/subclass default router #2219

vytas7 opened this issue Mar 25, 2024 · 0 comments

Comments

@vytas7
Copy link
Member

vytas7 commented Mar 25, 2024

We are getting feature requests and questions from the community to be able to route based on different properties of req than just path, see, e.g., #709.

We probably don't want to bloat the default router too much, OTOH, after #967, custom routers can go wild with the passed req object. However, at the time of this writing, it is a bit cumbersome to implement a new custom router -- although the protocol itself is straightforward and easy to understand, implementing a completely new routing strategy from scratch is quite an involved task, and it is unclear how to extend the default "compiled" router beyond simple wrappers around, e.g, add_route().

Things that already are easy to reuse:

Things that are opaque/private/undocumented/hard to reuse:

  • Extracting parameters from a URI template. Controlling how parameters are passed to a method. Unavailable in falcon.inspect either.
  • Parsing converter spec from a URI template, controlling how converters are called. Unavailable in falcon.inspect either.
  • Reusing/extending the compile machinery, all methods/locks are private except the compile flag itself.
  • Extended code generation in any way.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant