Christopher Hübner
01/09/2024, 2:19 PMfun Application.module() {
// load modules
}
If I had a Project with ~50 modules/plugins/services to load, would it be rational to user ktor, or is it mainly designed for microservices?Andrew O'Hara
01/09/2024, 2:38 PMChristopher Hübner
01/09/2024, 3:56 PMAndrew O'Hara
01/09/2024, 4:19 PMCLOVIS
01/09/2024, 5:05 PMApplication
extension function, and load them all in the configuration file:
ktor {
application {
modules = [ com.example.ApplicationKt.module1,
com.example.ApplicationKt.module2,
org.sample.SampleKt.module3 ]
}
}
Each module is independent and can have its own plugins, etc.
https://ktor.io/docs/modules.htmlDominik Sandjaja
01/11/2024, 12:14 PMinstall(Koin) {
slf4jLogger(level = Level.INFO)
modules(
module {
single { this@main }
single { this@main.environment.config }
},
module {
single { openTelemetry.getTracer("our-app", "1.0.0") }
},
module {
single { unleashService } bind ToggleService::class
},
metricsKoinSetup(),
configKoinSetup(serverConfig),
databaseKoinSetup(),
coreKoinSetup(),
kafkaKoinSetup(),
com.company.othermodule.setup.koinAuthModule,
com.company.othermodule.setup.koinUserModule,
...
And yes, it is annoying that the word module
is used everywhere for different things ...Christopher Hübner
01/11/2024, 12:28 PM