resource

inline fun <T : Any> Route.resource(noinline body: Route.() -> Unit): Route

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

A class T must be annotated with io.ktor.resources.Resource.


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

Registers a route 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.

A class T must be annotated with io.ktor.resources.Resource.