createRouteScopedPlugin
Creates a RouteScopedPlugin that can be installed into a io.ktor.server.routing.Route.
The example below create a plugin that prints a requested URL each time your application receives a call:
val RequestLoggingPlugin = createRouteScopedPlugin("RequestLoggingPlugin") {
onCall { call ->
println(call.request.uri)
}
}
route("index") {
install(RequestLoggingPlugin)
}
You can learn more from Custom plugins.
Parameters
A name of a plugin that is used to get its instance when it is installed to io.ktor.server.routing.Routing.
Defines how the initial PluginConfigT of your new plugin can be created. Please note that it may be modified later when a user of your plugin calls install.
Allows you to define handlers (onCall, onCallReceive, onCallRespond and so on) that can modify the behaviour of an Application where your plugin is installed.
Creates a RouteScopedPlugin that can be installed into a io.ktor.server.routing.Route.
The example below create a plugin that prints a requested URL each time your application receives a call:
val RequestLoggingPlugin = createRouteScopedPlugin("RequestLoggingPlugin") {
onCall { call ->
println(call.request.uri)
}
}
route("index") {
install(RequestLoggingPlugin)
}
You can learn more from Custom plugins.
Parameters
A name of a plugin that is used to get an instance of the plugin installed to the io.ktor.server.routing.Route.
Allows you to define handlers (onCall, onCallReceive, onCallRespond and so on) that can modify the behaviour of an Application where your plugin is installed.