Split features into files
This commit is contained in:
parent
cc0058892e
commit
49a3d47653
@ -2,6 +2,7 @@ package be.vandewalleh
|
|||||||
|
|
||||||
import be.vandewalleh.controllers.KodeinController
|
import be.vandewalleh.controllers.KodeinController
|
||||||
import be.vandewalleh.controllers.controllerModule
|
import be.vandewalleh.controllers.controllerModule
|
||||||
|
import be.vandewalleh.features.features
|
||||||
import com.fasterxml.jackson.databind.SerializationFeature
|
import com.fasterxml.jackson.databind.SerializationFeature
|
||||||
import io.ktor.application.Application
|
import io.ktor.application.Application
|
||||||
import io.ktor.application.install
|
import io.ktor.application.install
|
||||||
@ -17,18 +18,7 @@ lateinit var kodein: Kodein
|
|||||||
|
|
||||||
@Suppress("unused") // Referenced in application.conf
|
@Suppress("unused") // Referenced in application.conf
|
||||||
fun Application.module() {
|
fun Application.module() {
|
||||||
install(Locations)
|
features()
|
||||||
|
|
||||||
install(CORS) {
|
|
||||||
anyHost()
|
|
||||||
}
|
|
||||||
|
|
||||||
install(ContentNegotiation) {
|
|
||||||
jackson {
|
|
||||||
enable(SerializationFeature.INDENT_OUTPUT)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
kodein = Kodein {
|
kodein = Kodein {
|
||||||
import(controllerModule)
|
import(controllerModule)
|
||||||
|
|||||||
15
api/src/features/ContentNegotiationFeature.kt
Normal file
15
api/src/features/ContentNegotiationFeature.kt
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
package be.vandewalleh.features
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.databind.SerializationFeature
|
||||||
|
import io.ktor.application.Application
|
||||||
|
import io.ktor.application.install
|
||||||
|
import io.ktor.features.ContentNegotiation
|
||||||
|
import io.ktor.jackson.jackson
|
||||||
|
|
||||||
|
fun Application.contentNegotiationFeature() {
|
||||||
|
install(ContentNegotiation) {
|
||||||
|
jackson {
|
||||||
|
enable(SerializationFeature.INDENT_OUTPUT)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
11
api/src/features/CorsFeature.kt
Normal file
11
api/src/features/CorsFeature.kt
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
package be.vandewalleh.features
|
||||||
|
|
||||||
|
import io.ktor.application.Application
|
||||||
|
import io.ktor.application.install
|
||||||
|
import io.ktor.features.CORS
|
||||||
|
|
||||||
|
fun Application.corsFeature() {
|
||||||
|
install(CORS) {
|
||||||
|
anyHost()
|
||||||
|
}
|
||||||
|
}
|
||||||
9
api/src/features/Features.kt
Normal file
9
api/src/features/Features.kt
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
package be.vandewalleh.features
|
||||||
|
|
||||||
|
import io.ktor.application.Application
|
||||||
|
|
||||||
|
fun Application.features() {
|
||||||
|
locationFeature()
|
||||||
|
corsFeature()
|
||||||
|
contentNegotiationFeature()
|
||||||
|
}
|
||||||
9
api/src/features/LocationFeature.kt
Normal file
9
api/src/features/LocationFeature.kt
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
package be.vandewalleh.features
|
||||||
|
|
||||||
|
import io.ktor.application.Application
|
||||||
|
import io.ktor.application.install
|
||||||
|
import io.ktor.locations.Locations
|
||||||
|
|
||||||
|
fun Application.locationFeature() {
|
||||||
|
install(Locations)
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user