From bcb58d47d71c123e7df85f512eca05cfa4a62541 Mon Sep 17 00:00:00 2001 From: William Brawner Date: Mon, 5 Jul 2021 19:08:09 -0600 Subject: [PATCH] Add ktor dependencies and basic server --- api/build.gradle.kts | 4 ++++ .../com/wbrawner/twigs/server/Application.kt | 14 ++++++++++++++ api/src/main/resources/application.conf | 8 ++++++++ 3 files changed, 26 insertions(+) create mode 100644 api/src/main/kotlin/com/wbrawner/twigs/server/Application.kt create mode 100644 api/src/main/resources/application.conf diff --git a/api/build.gradle.kts b/api/build.gradle.kts index f261a97..f51dd4f 100644 --- a/api/build.gradle.kts +++ b/api/build.gradle.kts @@ -17,10 +17,14 @@ repositories { } val kotlinVersion: String by rootProject.extra +val ktorVersion = "1.6.1" dependencies { implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlinVersion") implementation("org.jetbrains.kotlin:kotlin-reflect:$kotlinVersion") + implementation("io.ktor:ktor-server-core:$ktorVersion") + implementation("io.ktor:ktor-server-cio:$ktorVersion") + implementation("ch.qos.logback:logback-classic:1.2.3") implementation("org.springframework.boot:spring-boot-starter-data-jpa") implementation("org.springframework.boot:spring-boot-starter-security") implementation("org.springframework.session:spring-session-jdbc") diff --git a/api/src/main/kotlin/com/wbrawner/twigs/server/Application.kt b/api/src/main/kotlin/com/wbrawner/twigs/server/Application.kt new file mode 100644 index 0000000..1ee73ca --- /dev/null +++ b/api/src/main/kotlin/com/wbrawner/twigs/server/Application.kt @@ -0,0 +1,14 @@ +package com.wbrawner.twigs.server + +import io.ktor.application.* +import io.ktor.routing.* + +fun main(args: Array): Unit = io.ktor.server.cio.EngineMain.main(args) + +fun Application.module(testing: Boolean = false) { + routing { + get("/") { + call.respondText("Hello, world!") + } + } +} \ No newline at end of file diff --git a/api/src/main/resources/application.conf b/api/src/main/resources/application.conf new file mode 100644 index 0000000..908b401 --- /dev/null +++ b/api/src/main/resources/application.conf @@ -0,0 +1,8 @@ +ktor { + deployment { + port = 8080 + } + application { + modules = [ com.wbrawner.twigs.server.ApplicationKt.module ] + } +}