-
-
Notifications
You must be signed in to change notification settings - Fork 16.5k
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
Pass route array through to pathRegexp() #2207
Comments
|
@mscdex can you provide like a use-case for how allowing an array would be useful? I'm not particularly against adding it, but without a compelling use-case, it's just yet another thing to maintain for possibly no real reason. |
It can be useful for reusing logic for multiple routers/routes, such as loading information from a database, etc. It's also easier to scan than doing a normal |
So would this be an example of your use? // use session for /admin and /forum
app.use(['/admin', '/forum'], session) |
That is one possible scenario, yes. |
lol. Just throw me a bone :) If you can just like paste some scenario you want to use it for, I will likely add it; I do need to use something for tests as well. |
OK, so it's actually not possible to do this until 5.x unless you can get |
/cc @blakeembrey |
@blakeembrey I cc'd you here to find out if you would be willing to make a 0.1.3 release with the fix "Better support for non-ending strict mode matches with a trailing slash" in it (one of the changes made in component/path-to-regexp@0702846). Without it, non-ending mode ( |
@dougwilson No problem, I'll leave a note here once I push out a fix for you. |
Sweet :) Oh, and it looks like the patch was actually a part of component/path-to-regexp@e3df263 not the other commit I sited, haha. |
@dougwilson I just realised there is an issue with this feature and the |
@blakeembrey hm... Can you elaborate more? Example? I just am not following the word you wrote, sorry! We can always talk in #2173 if that's what it relates to, a new issue, or in freenode IRC For this issue, I'm just looking to basically get |
So @blakeembrey specifically for this issue, these are the changes I'm thinking of: https://github.com/dougwilson/path-to-regexp/compare/fix/for-express-2207 |
I went ahead and made the PR https://github.com/component/path-to-regexp/pull/32 for what I think could become a 0.1.3 that I could put into an express 4.6 release, if you want to take a look. |
@mscdex depending on the situation of |
maybe we should just release a 5.x and drop semver so we could stop worrying about all these backwards compatibility edge cases |
@jonathanong eh, idk just yet :D I'm actually going to make a 5.x branch soon to push a bunch of future stuff, like path changes and such. |
how about a |
@aredridel it's going to be |
Cool. |
Currently it's possible to do:
or:
but not:
or:
I started to write a PR for this but it's conflicting with the work currently being done on implementing request path retrieval.
The text was updated successfully, but these errors were encountered: