playground running
This commit is contained in:
@ -5,4 +5,3 @@ kotlin.code.style=official
|
|||||||
# Gradle
|
# Gradle
|
||||||
org.gradle.vfs.watch=true
|
org.gradle.vfs.watch=true
|
||||||
org.gradle.vfs.verbose=true
|
org.gradle.vfs.verbose=true
|
||||||
|
|
||||||
|
19
gradle/libs.versions.toml
Normal file
19
gradle/libs.versions.toml
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
[versions]
|
||||||
|
kotlin = "1.4.32"
|
||||||
|
ktor = "1.5.3"
|
||||||
|
slf4j = "1.7.30"
|
||||||
|
logback = "1.2.3"
|
||||||
|
|
||||||
|
[libraries]
|
||||||
|
# API
|
||||||
|
ktor-server-core = { group = "io.ktor", name = "ktor-server-core", version.ref = "ktor" }
|
||||||
|
ktor-server-netty = { group = "io.ktor", name = "ktor-server-netty", version.ref = "ktor" }
|
||||||
|
ktor-jackson = { group = "io.ktor", name = "ktor-jackson", version.ref = "ktor" }
|
||||||
|
# Logging
|
||||||
|
slf4j = { group = "org.slf4j", name = "slf4j-api", version.ref = "slf4j" }
|
||||||
|
logback-classic = { group = "ch.qos.logback", name = "logback-classic", version.ref = "logback" }
|
||||||
|
logback-core = { group = "ch.qos.logback", name = "logback-core", version.ref = "logback" }
|
||||||
|
|
||||||
|
[bundles]
|
||||||
|
ktor = [ "ktor-server-core", "ktor-server-netty", "ktor-jackson" ]
|
||||||
|
logging = [ "slf4j", "logback-classic", "logback-core" ]
|
@ -5,6 +5,18 @@ plugins {
|
|||||||
dependencies {
|
dependencies {
|
||||||
implementation(platform("org.jetbrains.kotlin:kotlin-bom"))
|
implementation(platform("org.jetbrains.kotlin:kotlin-bom"))
|
||||||
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
|
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
|
||||||
|
|
||||||
|
implementation(projects.lib)
|
||||||
|
|
||||||
|
implementation(libs.bundles.ktor)
|
||||||
|
implementation(libs.bundles.logging)
|
||||||
|
|
||||||
testImplementation("org.jetbrains.kotlin:kotlin-test")
|
testImplementation("org.jetbrains.kotlin:kotlin-test")
|
||||||
testImplementation("org.jetbrains.kotlin:kotlin-test-junit")
|
testImplementation("org.jetbrains.kotlin:kotlin-test-junit")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
application {
|
||||||
|
@Suppress("DEPRECATION")
|
||||||
|
mainClassName = "org.leafygreens.kompendium.playground.MainKt"
|
||||||
|
applicationDefaultJvmArgs = listOf("-Dio.ktor.development=true") // TODO I don't think this is working 😢
|
||||||
|
}
|
||||||
|
@ -0,0 +1,28 @@
|
|||||||
|
package org.leafygreens.kompendium.playground
|
||||||
|
|
||||||
|
import io.ktor.application.Application
|
||||||
|
import io.ktor.application.call
|
||||||
|
import io.ktor.response.respondText
|
||||||
|
import io.ktor.routing.get
|
||||||
|
import io.ktor.routing.route
|
||||||
|
import io.ktor.routing.routing
|
||||||
|
import io.ktor.server.engine.embeddedServer
|
||||||
|
import io.ktor.server.netty.Netty
|
||||||
|
|
||||||
|
fun main() {
|
||||||
|
embeddedServer(
|
||||||
|
Netty,
|
||||||
|
port = 8080,
|
||||||
|
module = Application::mainModule
|
||||||
|
).start(wait = true)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun Application.mainModule() {
|
||||||
|
routing {
|
||||||
|
route("/") {
|
||||||
|
get {
|
||||||
|
call.respondText("hi")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
14
playground/src/main/resources/logback.xml
Normal file
14
playground/src/main/resources/logback.xml
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
<configuration>
|
||||||
|
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
|
||||||
|
<encoder>
|
||||||
|
<pattern>%d{YYYY-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
|
||||||
|
</encoder>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<root level="trace">
|
||||||
|
<appender-ref ref="STDOUT"/>
|
||||||
|
</root>
|
||||||
|
|
||||||
|
<logger name="org.eclipse.jetty" level="INFO"/>
|
||||||
|
<logger name="io.netty" level="INFO"/>
|
||||||
|
</configuration>
|
Reference in New Issue
Block a user