Skip to content

Commit

Permalink
Some API updates
Browse files Browse the repository at this point in the history
  • Loading branch information
yostane committed Jul 9, 2024
1 parent 74c3924 commit 1131745
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 29 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
const val SERVER_PORT = 8080
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
class Greeting {
private val platform = getPlatform()

fun greet(): String {
return "Hello, ${platform.name}!"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class JVMPlatform {
val name: String = "Java ${System.getProperty("java.version")}"
}

fun getPlatform() = JVMPlatform()
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<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>
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package org.example.project

import Greeting
import SERVER_PORT
import io.ktor.server.application.*
import io.ktor.server.engine.*
import io.ktor.server.netty.*
import io.ktor.server.response.*
import io.ktor.server.routing.*

fun main() {
embeddedServer(Netty, port = SERVER_PORT, host = "0.0.0.0", module = Application::module)
.start(wait = true)
}

fun Application.module() {
routing {
get("/") {
call.respondText("Ktor: ${Greeting().greet()}")
}
}
}

This file was deleted.

This file was deleted.

0 comments on commit 1131745

Please sign in to comment.