does ktor have reverse routing for the dsl?
# ktor
t
does ktor have reverse routing for the dsl?
o
what do you mean by “reverse routing”?
t
if i define an endpoint,
get("/my-path", ::controller)
, can i somehow get the path by asking ktor, using the controller as an argument?
getRoute(::controller)
would return
"/my-path"
o
not out of the box, no
you can scan the routing tree and find it, if it’s not in a performance critical code
what’s the task at hand, what are you trying to achieve where you need it?
t
a typical task would be building a link to one of your controllers. i'm not trying to use it in ktor, i'm just evaluating the usefulness of the feature. it's something i used a lot when i was using the play framework, but no other frameworks seem to implement it.
i think it's a really useful feature, but not a lot of people seem to agree
y
What would the result be if
::controller
is registered to multiple routes?
t
Typically the first one
o
Ah, typed locations. We have it differently