Skip to content

Commit

Permalink
Update to Ktor 3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
raharrison committed Oct 28, 2024
1 parent 38b9401 commit 34b8884
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 17 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

## Starter project to create a simple RESTful web service in Kotlin

**Updated for Kotlin 2.0.0 and Ktor 2.3.12**
**Updated for Kotlin 2.0.21 and Ktor 3.0.0**

Companion article: <https://ryanharrison.co.uk/2018/04/14/kotlin-ktor-exposed-starter.html>

Expand Down
18 changes: 9 additions & 9 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
val ktorVersion = "2.3.12"
val exposedVersion = "0.52.0"
val h2Version = "2.2.224"
val ktorVersion = "3.0.0"
val exposedVersion = "0.55.0"
val h2Version = "2.3.232"
val hikariCpVersion = "5.1.0"
val flywayVersion = "10.11.0"
val logbackVersion = "1.5.6"
val flywayVersion = "10.20.1"
val logbackVersion = "1.5.12"
val assertjVersion = "3.26.3"
val restAssuredVersion = "5.4.0"
val junitVersion = "5.10.1"
val restAssuredVersion = "5.5.0"
val junitVersion = "5.11.3"

plugins {
kotlin("jvm") version "2.0.0"
kotlin("plugin.serialization") version "2.0.0"
kotlin("jvm") version "2.0.21"
kotlin("plugin.serialization") version "2.0.21"
id("org.jetbrains.kotlinx.kover") version "0.8.2"
application
}
Expand Down
7 changes: 3 additions & 4 deletions src/main/kotlin/Main.kt
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import io.ktor.serialization.kotlinx.*
import io.ktor.serialization.kotlinx.json.*
import io.ktor.server.application.*
import io.ktor.server.engine.*
import io.ktor.server.netty.*
import io.ktor.server.plugins.callloging.*
import io.ktor.server.plugins.calllogging.*
import io.ktor.server.plugins.contentnegotiation.*
import io.ktor.server.plugins.defaultheaders.*
import io.ktor.server.routing.*
Expand All @@ -29,13 +28,13 @@ fun Application.module() {

val widgetService = WidgetService()

install(Routing) {
routing {
index()
widget(widgetService)
}

}

fun main(args: Array<String>) {
embeddedServer(Netty, commandLineEnvironment(args)).start(wait = true)
EngineMain.main(args)
}
1 change: 0 additions & 1 deletion src/main/kotlin/web/IndexResource.kt
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package web

import io.ktor.http.*
import io.ktor.server.application.*
import io.ktor.server.response.*
import io.ktor.server.routing.*

Expand Down
1 change: 0 additions & 1 deletion src/main/kotlin/web/WidgetResource.kt
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package web

import io.ktor.http.*
import io.ktor.server.application.*
import io.ktor.server.request.*
import io.ktor.server.response.*
import io.ktor.server.routing.*
Expand Down
2 changes: 1 addition & 1 deletion src/test/kotlin/common/ServerTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ open class ServerTest {

private var serverStarted = false

private lateinit var server: ApplicationEngine
private lateinit var server: EmbeddedServer<NettyApplicationEngine, NettyApplicationEngine. Configuration>

@BeforeAll
@JvmStatic
Expand Down

0 comments on commit 34b8884

Please sign in to comment.