-
Notifications
You must be signed in to change notification settings - Fork 7
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
Merging mapQuery and mapRoute #1
Comments
Hey Shaun, thanks for the feedback. You're right that for query string parameters that simply alter a route's behavior, like pagination, mapQuery doesn't serve much of a purpose. The method was written to handle query string parameters that would behave more as routes themselves, like:
As opposed to:
The use case in mind behind this was for sites that weren't necessarily making use of any particular url-hashing scheme, but needed to provide different entry points via the url. Say, On the other side of your first point, you're absolutely right that query string parameters following routes need to be made available in the route's parameters. Thanks for pointing that out, I don't have a good explanation for why I haven't written that in yet. I'll definitely be adding this functionality soon. As far as the route's |
jeremyruppel, I would say, give developer a choice. Params as object and getParam(name:String):String method. |
Firstly, thanks for the kick-ass library. I've written 2 similar (based on Sinatra) "router" libraries and wasn't happy with either implementation. Yours looks good.
I'm not sure how useful mapQuery is by itself.. or perhaps I misunderstand its use.. regardless, here's how I imagine query parameters to work for mapRoute:
As with Sinatra, both path segments and query parameters can be found in the params hash.
Perhaps mapQuery has another use-case that I'm missing however.
Also.. I'm not sure I'm a fan of event.route.params being a method. I might prefer params to be an actual hash (basic object):
Anyhoo, nice work. Look forward to trying it out.
The text was updated successfully, but these errors were encountered: