-
-
Notifications
You must be signed in to change notification settings - Fork 717
Routing support for wildcard parameters #4158
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
Labels
enhancement
New feature or request.
Comments
One thing to add is that there is a way to implement this type of wildcard routing without compromising performance. app.get('/someprefix/:parameter*', async (c, next) => {
// do things
}) |
Hi @ruimaciel As @EdamAme-x said, it can support a wildcard parameter with regexp like the following: app.get('/posts/:path{.+}', async (c) => {
return c.text(c.req.param("path"))
}) |
Indeed, supporting |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
What is the feature you are proposing?
Currently Hono's routing provides support for a number of parameters. However, there is no first-class support for usecases such as:
This type of usecase happens frequently when using Cloudflare Workers. Currently, the best way to address this usecase is to manually put together the parameter, similar to:
This works ok, but it leads to a subpar developer experience. I suppose that this could be done with regex parameters too.
Ideally, Hono would do this for us. It would be great if Hono provided support for wildcard parameters, where anything matching a wildcard would be conveniently provided through a parameter, similar to:
This topic was briefly touched in #591 , but so far without a response.
Would it be possible to implement wildcard parameters?
The text was updated successfully, but these errors were encountered: