Dariusz Kuc
02/01/2023, 11:12 PMBaseApplicationPlugin
that accepts a pipeline (e.g. ApplicationCallPipeline
) and BaseRouteScopedPlugin
which should be applied to a specific route.
Should I just use Application
which extends ApplicationCallPipeline
?Aleksei Tirman [JB]
02/02/2023, 8:26 AMribesg
02/02/2023, 8:59 AMRouting.setupMyPlugin(…)
function as entry point for this kind of librariesribesg
02/02/2023, 9:00 AMRouting
plugin, how could you add a route then?Dariusz Kuc
02/02/2023, 2:20 PMDariusz Kuc
02/02/2023, 2:25 PMDariusz Kuc
02/02/2023, 2:25 PMribesg
02/02/2023, 2:28 PMApplication.pluginOrNull(Routing)
and add routes like that? I don't remember if a plugin can access the app but I think it can?Dariusz Kuc
02/02/2023, 2:28 PMDariusz Kuc
02/02/2023, 2:29 PMApplication
extends ApplicationCallPipeline
Dariusz Kuc
02/02/2023, 2:29 PMribesg
02/02/2023, 2:31 PMval MyTestPlugin = createApplicationPlugin("MyTestPlugin") {
application.plugin(Routing).run {
get("/") { call.respond("Hello world") }
}
}
ribesg
02/02/2023, 2:31 PMRouting
isn't setup before your plugin but it should just workDariusz Kuc
02/02/2023, 2:32 PMribesg
02/02/2023, 2:32 PMapplication.pluginOrNull(Routing) ?: error("MyTestPlugin requires Routing plugin to be setup before")
or somethingDariusz Kuc
02/02/2023, 9:03 PMpublic fun Application.routing(configuration: Routing.() -> Unit): Routing =
pluginOrNull(Routing)?.apply(configuration) ?: install(Routing, configuration)
ribesg
02/03/2023, 9:00 AMinstall(Routing)
afterwards?Dariusz Kuc
02/03/2023, 1:27 PM