Skip to content

Route multiple paths to same handler. #992

Answered by usualoma
msuntharesan asked this question in Q&A
Discussion options

You must be logged in to vote

Hi, @msuntharesan!

When defined as follows

const app = new Hono()
  .get('/:prep1/:p1', myHandler)
  .get('/:p1/:postp1', myHandler)

The value of c.param('p1') is ambiguous for the following request.

app.request('http://localhost/path1/path2')

Therefore, the hono does not allow such routing definitions.

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@msuntharesan
Comment options

Answer selected by msuntharesan
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants