resource

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

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> Routing.resource(serializer: KSerializer<T>, body: Routing.() -> Unit): Routing

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.