-
Notifications
You must be signed in to change notification settings - Fork 17
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
Support mixing dynamic params with static string in same segment #11
Comments
Hi @SilentDepth and thanks for repro and explaining. The issue you are facing is that Currently, radix 3 does not allow combining a param name with some static prefix and/or suffix in the same segment like |
Hey there, just chiming in with a temporary workaround for this issue/out-of-scope request I managed to support file extensions routing by transforming routes before resolving them, something in that fashion if that makes sense (simplified for clarity purpose): import { createRouter } from "radix3";
const router = createRouter();
router.insert("/foo/:msg/dot/txt");
router.lookup("/foo/something.txt".replace(".", "/dot/")); It's limited, and suboptimal, but it ain't stupid if it works ^^' I'm curious however if this is out-of-scope for radix 3 or what are the plans, if any, to either support something like that or supporting/replacing colon-based parameters ( Happy to help~ |
Repro
https://runkit.com/silentdepth/633470604bb52500089af4de
Issue
One
/:msg
/:msg.txt
The current version sees these 2 patterns as the same, and the second will overrides the first. However, they should be different.
Two
/:msg.txt
/:msg/uppercase.txt
Just not sure how these work... The result confuses me.
Versions
Node: 16.17.0
radix3: 0.1.2
The text was updated successfully, but these errors were encountered: