AlexxNB / tinro

Highly declarative, tiny, dependency free router for Svelte's web applications.
MIT License
669 stars 30 forks source link

Advanced matching #52

Closed mustafa0x closed 3 years ago

mustafa0x commented 3 years ago

Is there anyway to match something like /:id-:slug? Or does it have to be /:id/:slug?

What would be the easiest way to achieve /:id-:slug?

AlexxNB commented 3 years ago

You may use param /:idandslug, then just split it inside the route like this:

const meta = router.meta();
let id,slug;
`$:  [id,slug] = $meta.params.idandslug.split('-');
mustafa0x commented 3 years ago

Thank you, that's good enough.

mustafa0x commented 2 years ago

I'm finding myself needing regex match more often. Is there any chance regex support will be added at some point? Thanks.