Closed ghost closed 7 years ago
Yes this is only related to path-to-regexp
and should work by default. Maybe it conflicts with the last parameter, then it could help to use a regular expression for the path definition.
I think it's actually related to the other issue I opened. next-routes wasn't fully running because of my own ignorance (though, oddly it looked like it was). Once I got that sorted, this issue also resolved. Thanks. Great package BTW.
This might be more related
path-to-regexp
, but figured I'd start here.I'd like to create a route definition that works with and without the ending slash. For example:
routes.add('myEntity', '/entity/:id\/*', 'entityPage');
What I want here is for the router to accept both of the following:
http://localhost:3000/entity/foo
and
http://localhost:3000/entity/foo/
Where
foo
is mapped to theid
parameter.Is this possible? Is this a question for
path-to-regexp
instead?It seems
path-to-regexp
does this by default and it doesn't look likenext-routes
is overriding this default. So maybe this is a bug? Should the following routes, be default, both resolve to the same page:http://localhost:3000/entity/foo
http://localhost:3000/entity/foo/