Support parameters in paths
abahmed opened this issue · 3 comments
abahmed commented
Allow user to specify parameters in paths while adding routes (e.g. gearbox.Get("/user/:name, ...)).
Discussions / suggestions is open here
- The proper delimiter (:name, or {name})
- How these parameters will be passed to handler
raubrey2014 commented
@abahmed @muhammednagy - I'm happy to dive into this one, would want to run my thoughts by you all.
- I personally prefer the
:name
notation as to me it is just visually cleaner. The only other supporting argument may be that using:name
does not conflict with common regex syntax (if we introduced more advanced regex matching in routes). For example, I think/users/([0-9]{4})/:product
is preferable to/users/([0-9]{4})/{product}
. - Do we think this is dependent on #11 ? I believe will eventually need to parse path parameters out of the Ternary Search Tree. We can attempt to proceed in a manner that is independent of whether the nodes of the TST are of type
[]byte
orstring
.
Let me know what you guys think 👍
abahmed commented
Thanks @raubrey2014 :-)
- I do agree with you on using ":" delimiter
- Yes, agree with you too. They affect each other but they are not blocking each other.
muhammednagy commented
I pretty much agree.
':' does make more sense yes.