hono icon indicating copy to clipboard operation
hono copied to clipboard

wild card for multiple routes does not work

Open skandasoft opened this issue 1 year ago • 2 comments

What version of Hono are you using?

4.6.3

What runtime/platform is your app running on?

Deno

What steps can reproduce the bug?

Multiple wild card fails.

app.get(
  '/*.html',
  async (c, next) => {
    console.log('in html');

    await next();
  }
// this next route overrides the wildcard 
app.get(
  '/css/*.css',
  async (c, next) => {
    console.log('in css');

    await next();
  }


What is the expected behavior?

when requesting for '/index.html' -> both console should work

What do you see instead?

none of the console is working. looks like the second wild card must have overridden and messed up everything. No response

Additional information

No response

skandasoft avatar Oct 09 '24 23:10 skandasoft

Hi @skandasoft

It's not a bug. Use a regexp: https://hono.dev/docs/api/routing#regexp

yusukebe avatar Oct 11 '24 00:10 yusukebe

I tried a few regex to match .html and css/.css, it doesn't seem to work. Is there a particular format in which need to sent the regex to the route?

skandasoft avatar Oct 21 '24 16:10 skandasoft

This issue has been marked as stale due to inactivity.

github-actions[bot] avatar Nov 03 '24 00:11 github-actions[bot]

Closing this issue due to inactivity.

github-actions[bot] avatar Nov 06 '24 00:11 github-actions[bot]