Merge pull request #102 from joreilly/backend_ktor_2
update backend module to also use Ktor 2.0
This commit is contained in:
commit
b2129ebff9
4 changed files with 10 additions and 22 deletions
|
@ -16,8 +16,9 @@ dependencies {
|
||||||
with(Deps.Ktor) {
|
with(Deps.Ktor) {
|
||||||
implementation(serverCore)
|
implementation(serverCore)
|
||||||
implementation(serverNetty)
|
implementation(serverNetty)
|
||||||
//implementation(serialization)
|
|
||||||
implementation(websockets)
|
implementation(websockets)
|
||||||
|
implementation(serverContentNegotiation)
|
||||||
|
implementation(json)
|
||||||
}
|
}
|
||||||
|
|
||||||
with(Deps.Log) {
|
with(Deps.Log) {
|
||||||
|
|
|
@ -2,14 +2,13 @@ import com.surrus.common.di.initKoin
|
||||||
import com.surrus.common.remote.Assignment
|
import com.surrus.common.remote.Assignment
|
||||||
import com.surrus.common.remote.AstroResult
|
import com.surrus.common.remote.AstroResult
|
||||||
import com.surrus.common.remote.PeopleInSpaceApi
|
import com.surrus.common.remote.PeopleInSpaceApi
|
||||||
import io.ktor.application.*
|
import io.ktor.server.application.*
|
||||||
import io.ktor.features.*
|
import io.ktor.serialization.kotlinx.json.*
|
||||||
import io.ktor.http.*
|
|
||||||
import io.ktor.response.*
|
|
||||||
import io.ktor.routing.*
|
|
||||||
import io.ktor.serialization.*
|
|
||||||
import io.ktor.server.engine.*
|
import io.ktor.server.engine.*
|
||||||
import io.ktor.server.netty.*
|
import io.ktor.server.netty.*
|
||||||
|
import io.ktor.server.plugins.*
|
||||||
|
import io.ktor.server.response.*
|
||||||
|
import io.ktor.server.routing.*
|
||||||
|
|
||||||
fun main() {
|
fun main() {
|
||||||
val koin = initKoin(enableNetworkLogs = true).koin
|
val koin = initKoin(enableNetworkLogs = true).koin
|
||||||
|
@ -22,20 +21,6 @@ fun main() {
|
||||||
json()
|
json()
|
||||||
}
|
}
|
||||||
|
|
||||||
install(CORS) {
|
|
||||||
method(HttpMethod.Options)
|
|
||||||
method(HttpMethod.Put)
|
|
||||||
method(HttpMethod.Delete)
|
|
||||||
method(HttpMethod.Patch)
|
|
||||||
header(HttpHeaders.Authorization)
|
|
||||||
header(HttpHeaders.ContentType)
|
|
||||||
header(HttpHeaders.AccessControlAllowOrigin)
|
|
||||||
// header("any header") if you want to add any header
|
|
||||||
allowCredentials = true
|
|
||||||
allowNonSimpleContentTypes = true
|
|
||||||
anyHost()
|
|
||||||
}
|
|
||||||
|
|
||||||
routing {
|
routing {
|
||||||
|
|
||||||
get("/astros.json") {
|
get("/astros.json") {
|
||||||
|
|
|
@ -112,6 +112,8 @@ object Deps {
|
||||||
const val contentNegotiation = "io.ktor:ktor-client-content-negotiation:${Versions.ktor}"
|
const val contentNegotiation = "io.ktor:ktor-client-content-negotiation:${Versions.ktor}"
|
||||||
const val json = "io.ktor:ktor-serialization-kotlinx-json:${Versions.ktor}"
|
const val json = "io.ktor:ktor-serialization-kotlinx-json:${Versions.ktor}"
|
||||||
|
|
||||||
|
const val serverContentNegotiation = "io.ktor:ktor-server-content-negotiation:${Versions.ktor}"
|
||||||
|
|
||||||
const val websockets = "io.ktor:ktor-websockets:${Versions.ktor}"
|
const val websockets = "io.ktor:ktor-websockets:${Versions.ktor}"
|
||||||
const val clientCore = "io.ktor:ktor-client-core:${Versions.ktor}"
|
const val clientCore = "io.ktor:ktor-client-core:${Versions.ktor}"
|
||||||
const val clientJson = "io.ktor:ktor-client-json:${Versions.ktor}"
|
const val clientJson = "io.ktor:ktor-client-json:${Versions.ktor}"
|
||||||
|
|
|
@ -11,5 +11,5 @@ rootProject.name = "PeopleInSpace"
|
||||||
include(":app", ":common", ":compose-desktop")
|
include(":app", ":common", ":compose-desktop")
|
||||||
include(":web")
|
include(":web")
|
||||||
include(":compose-web")
|
include(":compose-web")
|
||||||
//include(":backend")
|
include(":backend")
|
||||||
include(":wearApp")
|
include(":wearApp")
|
||||||
|
|
Loading…
Reference in a new issue