There is already the existing server.match() function that can be given an HTTP Method an URL Path, and will return the Route config that gets used. Unfortunately this doesn't tell you what binds were used for route parameters.
And I call server.match('GET', '/test/foo/bar') then I get back an object that I can use to determine the matched route. From this I can see that route.settings.id is equal to test-route, but I've got no way - as far as I can tell - to get the fact that {name} = "foo" or {value} = "bar".
Being able to determine these values would be hugely beneficial for Hypermedia APIs, since I can then consume URIs that were included in payloads and work out not only which route they refer to, but they binds onto those routes that I actually need for my application. (I can already generate the URIs from the values using Akaya, so that's not an issue)
There is already the existing
server.match()
function that can be given an HTTP Method an URL Path, and will return the Route config that gets used. Unfortunately this doesn't tell you what binds were used for route parameters.For example, if I have a route config of:
And I call
server.match('GET', '/test/foo/bar')
then I get back an object that I can use to determine the matched route. From this I can see thatroute.settings.id
is equal totest-route
, but I've got no way - as far as I can tell - to get the fact that{name}
= "foo" or{value}
= "bar".Being able to determine these values would be hugely beneficial for Hypermedia APIs, since I can then consume URIs that were included in payloads and work out not only which route they refer to, but they binds onto those routes that I actually need for my application. (I can already generate the URIs from the values using Akaya, so that's not an issue)