Philip Dukhov
11/12/2021, 5:15 AM// server
route("user") {
post("setFavorite") {
}
}
route("auth") {
post("facebook") {
}
}
route("other") {
}
// client
<http://client.post|client.post><Unit>("/user/setFavorite")
I'd like to share this names to prevent errors. For example with interface like this:
sealed interface ServerRoutes {
sealed interface User: ServerRoutes {
object SetFavorite: User
}
sealed interface Auth: ServerRoutes {
object Facebook: Auth
}
object Other: ServerRoutes
}
Which could be used like this:
// server
route(ServerRoutes.User) {
post(ServerRoutes.User.SetFavorite) {
}
}
route(ServerRoutes.Auth) {
post(ServerRoutes.Auth.Facebook) {
}
}
route(ServerRoutes.Other) {
}
// client
<http://client.post|client.post><Unit>(ServerRoutes.User.SetFavorite)
I think I can generate routes from class names using annotation processor, but I'm wondering if there's some existing solution?hfhbd
11/12/2021, 11:19 AMHTTPClient
as parameter and use this API class in the clients and in the backend tests as well to prevent wrong names, different methods, response codes, body serialization etc: https://github.com/hfhbd/ComposeTodo/blob/main/shared/src/commonMain/kotlin/app/softwork/composetodo/API.kt
https://github.com/hfhbd/ComposeTodo/blob/main/backend/src/test/kotlin/app/softwork/composetodo/TodoModuleKtTest.ktPhilip Dukhov
11/12/2021, 5:38 PMLocations
is exactly what I'm looking for! Sadly it doesn't support multiplatform so far, I only have found this feature requestAleksei Tirman [JB]
11/15/2021, 9:01 AMLocations
plugin that will support multiplatform.