`location` is two-way thing. Given `@location(“/a...
# ktor
o
location
is two-way thing. Given
@location(“/a/{id}/b”) class Foo(val id : Int, val optional : String = “default")
On the routing side, when you use it like
get<Foo> { it.id }
it creates routing entry with “/a/{id}/b” path, much like
route(“/a/{id}/b”)
and when routing is executed, it binds path variable
id
and query variable
optional
and creates instance of Foo. It then passes it into the lambda. On the other side, you can get URI for existing instance of Foo, so that given
Foo(1, “yes”)
you will get
/a/1/b?optional=yes
URI.