handle

inline fun <T : Any> Route.handle(noinline body: suspend RoutingContext.(T) -> Unit)

Registers a handler body for a resource defined by the T class.

Parameters

body

receives an instance of the typed resource T as the first parameter.


fun <T : Any> Route.handle(serializer: KSerializer<T>, body: suspend RoutingContext.(T) -> Unit)

Registers a handler body for a resource defined by the T class.

Parameters

serializer

is used to decode the parameters of the request to an instance of the typed resource T.

body

receives an instance of the typed resource T as the first parameter.