Skip to content

Commit 54aeaab

Browse files
Update ktor example to be a sample project (#24)
* Update ktor example to be a sample project
1 parent 9f56c02 commit 54aeaab

File tree

13 files changed

+616
-27
lines changed

13 files changed

+616
-27
lines changed

examples/README.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,14 @@ These examples use `Spring` to serve the front end.
2121

2222
These examples use `Quarkus` to serve the front end.
2323

24-
- [Quarkus Rest](quarkus/quarkus-rest-example/src/main/kotlin/dev/datastar/kotlin/CounterApp.kt) : Demonstrates integration with Quarkus Rest.
24+
- [Quarkus Rest](quarkus/quarkus-rest-example/src/main/kotlin/dev/datastar/kotlin/CounterApp.kt): Demonstrates integration with Quarkus Rest.
2525
- [Quarkus Qute](quarkus/quarkus-qute-example/src/main/kotlin/dev/datastar/kotlin/QuteCounterApp.kt): Demonstrates integration with Qute templates as templating engine.
2626

2727
## Ktor
2828

29-
This example uses `Ktor` to serve the front end. ([code](ktor/server.kt))
29+
This example uses `Ktor` to serve the front end.
3030

31-
```shell
32-
cd ./ktor ; jbang server.kt ; cd ..
33-
```
31+
- [Ktor Routing](ktor/ktor-example/src/main/kotlin/Application.kt): Demonstrates integration with Ktor Routing.
3432

3533
## Java HTTP Server
3634

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
val kotlin_version: String by project
2+
val logback_version: String by project
3+
4+
plugins {
5+
kotlin("jvm") version "2.1.10"
6+
id("io.ktor.plugin") version "3.2.3"
7+
}
8+
9+
group = "dev.datastar.kotlin"
10+
version = "0.0.1"
11+
12+
application {
13+
mainClass = "io.ktor.server.netty.EngineMain"
14+
}
15+
16+
java {
17+
toolchain {
18+
languageVersion = JavaLanguageVersion.of(21)
19+
}
20+
}
21+
22+
dependencies {
23+
implementation("dev.data-star.kotlin:kotlin-sdk:1.0.0-RC1")
24+
implementation("io.ktor:ktor-server-core")
25+
implementation("io.ktor:ktor-server-netty")
26+
implementation("ch.qos.logback:logback-classic:$logback_version")
27+
implementation("io.ktor:ktor-server-config-yaml")
28+
testImplementation("io.ktor:ktor-server-test-host")
29+
testImplementation("org.jetbrains.kotlin:kotlin-test-junit:$kotlin_version")
30+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
kotlin.code.style=official
2+
kotlin_version=2.1.10
3+
ktor_version=3.2.3
4+
logback_version=1.5.13
42.7 KB
Binary file not shown.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
distributionBase=GRADLE_USER_HOME
2+
distributionPath=wrapper/dists
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip
4+
networkTimeout=10000
5+
validateDistributionUrl=true
6+
zipStoreBase=GRADLE_USER_HOME
7+
zipStorePath=wrapper/dists

examples/ktor/ktor-example/gradlew

Lines changed: 251 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)