Is there an RPC plugin that allows to specify inte...
# javascript
e
Is there an RPC plugin that allows to specify interface in common code
Copy code
data class User(val id: Int)

@RpcService
interface UserService {
  suspend fun getUsers(): List<User>
}
and generates client for use in Kotlin/JS
Copy code
class HomeView : ReactDOMComponent<HomeView.Props, HomeView.State>() {
    prival val userService: UserService by removeServicesPlugin

    override suspend fun componentWillMount() {
        super.componentWillMount()
        state.users = userService.getUsers()
    }
}
r
https://github.com/rjaros/kvision allows something like this for Spring Boot, Ktor and Jooby
If you only want the rpc without the rest of KVision framework take a look here: https://kvision.gitbook.io/kvision-guide/part-3-server-side-interface/external-usage
👍 1