31 lines
946 B
Kotlin
31 lines
946 B
Kotlin
package fi.schro
|
|
|
|
import fi.schro.data.AccessoryInfoRepository
|
|
import fi.schro.data.AccessoryInfoRepositoryImpl
|
|
import fi.schro.data.LightRepository
|
|
import fi.schro.data.LightRepositoryImpl
|
|
import io.ktor.server.engine.*
|
|
import io.ktor.server.netty.*
|
|
import io.ktor.serialization.kotlinx.json.*
|
|
import io.ktor.server.plugins.*
|
|
import io.ktor.server.application.*
|
|
import fi.schro.routing.*
|
|
import kotlinx.serialization.json.Json
|
|
|
|
fun main() {
|
|
val lightRepository: LightRepository = LightRepositoryImpl()
|
|
val accessoryInfoRepository: AccessoryInfoRepository = AccessoryInfoRepositoryImpl()
|
|
val routing = Routing(lightRepository, accessoryInfoRepository)
|
|
|
|
embeddedServer(Netty, port = 9123, host = "0.0.0.0") {
|
|
install(ContentNegotiation) {
|
|
json(Json {
|
|
prettyPrint = true
|
|
isLenient = true
|
|
})
|
|
}
|
|
|
|
routing.configureRouting(this)
|
|
}.start(wait = true)
|
|
}
|