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
Issue or Feature Request Description:
At the moment the express and regex routes will pass in an object into the handle method with a 'params' value.
With a regex route of const regexRoute = /\/1234567890\/(\w+)\//; I'd expect to be able to access the capturing group via params, which we can do, but it's not labelled clearly.
Given that the args variable also includes args.url, the params.input value is not useful and params[0] is not exactly useful either.
With express, this follows the same pattern.
For express route of /:date/:id/test/I would expect params to have a data and id value, but it's just index values with '0' being route and 1 being the date value and 2 being the id value.
Also worth nothing that the 'date' value in this example is parsed as a number rather than a string. Not sure if we should be consistent with that or not.
The text was updated successfully, but these errors were encountered:
gauntface
changed the title
RegexpRoute and ExpressRoute
RegexpRoute and ExpressRoute Improving Params Output.
Jan 6, 2017
Library Affected: sw-routing
Browser & Platform: All
Issue or Feature Request Description:
At the moment the express and regex routes will pass in an object into the handle method with a 'params' value.
With a regex route of
const regexRoute = /\/1234567890\/(\w+)\//;
I'd expect to be able to access the capturing group via params, which we can do, but it's not labelled clearly.The above would result in:
Given that the
args
variable also includesargs.url
, the params.input value is not useful andparams[0]
is not exactly useful either.With express, this follows the same pattern.
For express route of
/:date/:id/test/
I would expect params to have a data and id value, but it's just index values with '0' being route and 1 being the date value and 2 being the id value.I'd expect:
Also worth nothing that the 'date' value in this example is parsed as a number rather than a string. Not sure if we should be consistent with that or not.
The text was updated successfully, but these errors were encountered: