Skip to content

Instantly share code, notes, and snippets.

@markchristopherng
Created July 25, 2021 11:58
Show Gist options
  • Save markchristopherng/987c06893689b063d778eb31d72924e9 to your computer and use it in GitHub Desktop.
Save markchristopherng/987c06893689b063d778eb31d72924e9 to your computer and use it in GitHub Desktop.
fun Application.module() {
val jsonParser = Json {
ignoreUnknownKeys = true
isLenient = true
}
install(ContentNegotiation) {
json(jsonParser)
}
val client = HttpClient(Apache) {
install(JsonFeature) {
serializer = KotlinxSerializer(jsonParser)
}
}
install(Koin) {
slf4jLogger()
modules(org.koin.dsl.module { single { client }; single { jsonParser } }, greetingModule)
}
registerGreetingRoutes()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment