-
Notifications
You must be signed in to change notification settings - Fork 595
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
Router match with and without trailing slash? #590
Comments
Makes sense to me! I think we were thinking of rewriting the router anyway
to allow for bundle splitting, so this is quite the useful addition ^_^
…On Mon, Oct 23, 2017, 07:04 Jon-Kyle ***@***.***> wrote:
Hey all, ran into a funny one tonight. What are thoughts on matching the
router against routes both with and without trailing slashes? For instance,
if I add a route like this:
app.route('/about, view)
… should I expect it to work when navigating to both /about and /about/?
Currently the latter does not. Open to thoughts! I think it’d be useful.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#590>, or mute the thread
<https://github.com/notifications/unsubscribe-auth/ACWleiraZ6Flgq8YKUGrFdS7Y99l77Pxks5svB5WgaJpZM4QCTCG>
.
|
Great to hear that you're working on a new version of the router, @yoshuawuyts. I was just about to make a PR implementing path-to-regexp (which has an option for strict mode to ignore trailing slash or not), though my motivation was to get optional parameters. Maybe that would be a candidate for the rewrite? |
@tornqvist a PR to to |
What do you mean it’s not JavaScript? The size concern does make sense though, I’ll see what I can come up with. |
@tornqvist oh, it's TypeScript if I read it right. If possible it'd be nice to keep all our deps in basic JS without compile steps; that way everyone can read it, and everyone can tweak it. Does that make sense? |
Def makes sense but the main export is plain old ES4 (with super expressive JSDoc). Though their tests are in TypeScript and they have some type definition files in their repo. But so does choo. Either way, I tend to agree that almost 400 LOC just to get some regex magic in routes can be considered overkill for a 4kb framework. |
Hey all, ran into a funny one tonight. What are thoughts on matching the router against routes both with and without trailing slashes? For instance, if I add a route like this:
… should I expect it to work when navigating to both
/about
and/about/
? Currently the latter does not. Open to thoughts! I think it’d be useful.The text was updated successfully, but these errors were encountered: