choo icon indicating copy to clipboard operation
choo copied to clipboard

Support express style routing with trailing wildcard

Open graforlock opened this issue 8 years ago • 3 comments

Expected behavior

/route/match* is a standard behavior.

Actual behavior

/route/match* breaks the router.

Steps to reproduce behavior

If you do /route/match* , and then navigate to /route/match/ or /route/match you get an error in both cases. So, you need to double up with:

/route/match /route/match/*

And this creates discrepancy between express and choo methodology which is visible especially when passing routes down to choo from express level to accomplish SSR.

graforlock avatar Sep 14 '17 22:09 graforlock

Probably would need to make https://github.com/choojs/nanorouter support this

bcomnes avatar Sep 14 '17 22:09 bcomnes

Yeah I will have a look and submit PR for nanorouter whenever I can.

graforlock avatar Sep 15 '17 21:09 graforlock

Would you expect this to also match against /route/matchsomething?

FUI I guess nanorouter will never support all patterns express supports. express has a very complex router that also supports a regexes.

marcbachmann avatar Jan 02 '18 22:01 marcbachmann