Skip to content

Dynamic routes

Ivan “CLOVIS” Canet requested to merge 8-dynamic-routes into main

Example usage:

object Api2 : RootResource("v2") {
    object Users : StaticResource<Api2>("users", Api2) {
        object User : DynamicResource<Users>("user", Users) {
            val get by get()
        }
    }
}

// Server-side
route(Api2.Users.User) {
    // …
}

// Client-side
client.request(Api2 / Users / User("123456") / User.get)

Ideally, I would have preferred the client-side syntax to be as follows, but I didn't manage to achieve it while staying typesafe:

client.request(Api2.Users.User("123456").get)

Maybe in the future we can find a way to make it more similar.

Closes #8 (closed)

Edited by Ivan “CLOVIS” Canet

Merge request reports