You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
where the id of a concert is a string formatted like that:
'yyyy/mm/dd/venue/artist'
Now the problem is, if we hit that route:
'/concerts/2014/11/21/venue/artist/videos'
the field req.params.id isn't populated with the value '2014/11/21/venue/artist' as expected, it only contains the value '2014'.
I was wondering if this is the intended behaviour or if this is a bug? I tried to update path-to-regexp from 0.1.3 to its latest version and then everything seemed to work just the way I though it would work.
The text was updated successfully, but these errors were encountered:
We cannot upgrade since it's not back-wards compatible. It will be upgraded in 5.0 when it comes out, through. If there is a bug and you can get path-to-regexp to publish a new 0.1.x version, we can definitely upgrade to that :)
Actually, I'm sorry, I didn't realize the two posts were different people (I thought it was the author confirming it was working with a newer version). So, I re-read the initial post and it's actually working as intended: we only match within path segments (only between the /). You can use your style if you either enumerate out your format in the string ("/concerts/:yyyy/:mm/:dd/:venue/:artist/videos") or you use a regular expression (/\/conerts\/(.+?)\/videos\/?$/).
Another option is that if you want to treat your ID as a single entity in a URL, you need to URL-encode that ID as for proper insertion as a path component: "/contents/" + encodeURIComponent(id) + "/videos".
Hi,
I've noticed something weird about named parameters in routes. In our app, we use a route similar to this one:
where the id of a concert is a string formatted like that:
'yyyy/mm/dd/venue/artist'
Now the problem is, if we hit that route:
'/concerts/2014/11/21/venue/artist/videos'
the field
req.params.id
isn't populated with the value'2014/11/21/venue/artist'
as expected, it only contains the value'2014'
.I was wondering if this is the intended behaviour or if this is a bug? I tried to update path-to-regexp from
0.1.3
to its latest version and then everything seemed to work just the way I though it would work.The text was updated successfully, but these errors were encountered: