-
-
Notifications
You must be signed in to change notification settings - Fork 17.1k
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
Allow +
quantifier into path pattern
#2134
Comments
You will need to file an issue at https://github.com/component/path-to-regexp which is the engine we use. |
I thought about it before issue a ticket, but this task cannot be completed only by regexp, since regexp may only match a group but group must be processed ( splitted ) elsewhere. But it seems like implementation implies changes in architecture, so maybe you should consider it in next release and do not use only regexp-based match but more featured engine and provide even more places where custom logic can be bound. |
From what I understood from your initial post RegExp can, but re-reading your post I realize I don't know what you're asking anyway. Are you saying you want a way to enforce some kind of ordering? Like you want to match Anyway, we provide a way to implement your own custom logic: |
Idea is simple. Addressable resources in hierarchy may have url like
/a/b/c/....
. So I canGET /a/b
orGET /a
but cannotGET /a/c
. To handle it I simply define path by regexp and it works well, but I think that+
quantifier will help to save a couple of lines of code.That is I would define path like this
/:id+
and if it applied to path/a/b/c
thenreq.params.id
should have[ 'a', 'b', 'c' ]
My suggestion is to add
+
quantifier that allow to defineThe text was updated successfully, but these errors were encountered: