Skip to content

Commit

Permalink
Update samples
Browse files Browse the repository at this point in the history
  • Loading branch information
wlybe committed Apr 16, 2024
1 parent c1fe126 commit e026c57
Show file tree
Hide file tree
Showing 27 changed files with 601 additions and 135 deletions.
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.

Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ captures
.externalNativeBuild
.cxx
local.properties
xcuserdata
xcuserdata
bin
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// source: https://gist.github.com/dellisd/a1e2ae1a7e6b61590bef4b2542a555a0

package kotlin2.experimental

class Test {
val names: List<String>
field: MutableList<String> = mutableListOf<String>()

fun doThing() {
names.add("Hello!")
}
}

fun main() {
println(C().elementList)

val list = [1, 2, 3]
println(list)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/*
* This Kotlin source file was generated by the Gradle 'init' task.
*/
package kotlin2.experimental

import kotlin.test.Test

class AppTest {
@Test fun appHasAGreeting() {}
}
36 changes: 36 additions & 0 deletions material/rest-api-http4k/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
.gradle
build/
!gradle/wrapper/gradle-wrapper.jar
!**/src/main/**/build/
!**/src/test/**/build/

### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
bin/
!**/src/main/**/bin/
!**/src/test/**/bin/

### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr
out/
!**/src/main/**/out/
!**/src/test/**/out/

### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/

### VS Code ###
.vscode/
7 changes: 7 additions & 0 deletions material/rest-api-http4k/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# HelloWorld

## Package
```
./gradlew distZip
```

65 changes: 65 additions & 0 deletions material/rest-api-http4k/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
import org.gradle.api.JavaVersion.VERSION_11
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
kotlin("jvm") version "1.9.23"
application
}

buildscript {
repositories {
mavenCentral()
gradlePluginPortal()
}

dependencies {
}
}

val http4kVersion: String by project
val http4kConnectVersion: String by project
val junitVersion: String by project
val kotlinVersion: String by project

application {
mainClass = "com.worldline.HelloWorldKt"
}

repositories {
mavenCentral()
}

apply(plugin = "kotlin")

tasks {
withType<KotlinCompile> {
kotlinOptions {
allWarningsAsErrors = false
jvmTarget = "11"
freeCompilerArgs += "-Xjvm-default=all"
}
}

withType<Test> {
useJUnitPlatform()
}

java {
sourceCompatibility = VERSION_11
targetCompatibility = VERSION_11
}
}

dependencies {
implementation("org.http4k:http4k-client-okhttp:${http4kVersion}")
implementation("org.http4k:http4k-core:${http4kVersion}")
implementation("org.http4k:http4k-format-kotlinx-serialization:${http4kVersion}")
implementation("org.http4k:http4k-server-undertow:${http4kVersion}")
implementation("org.http4k:http4k-template-jte:${http4kVersion}")
implementation("org.jetbrains.kotlin:kotlin-stdlib:${kotlinVersion}")
testImplementation("org.http4k:http4k-testing-approval:${http4kVersion}")
testImplementation("org.http4k:http4k-testing-hamkrest:${http4kVersion}")
testImplementation("org.junit.jupiter:junit-jupiter-api:5.10.2")
testImplementation("org.junit.jupiter:junit-jupiter-engine:5.10.2")
}

4 changes: 4 additions & 0 deletions material/rest-api-http4k/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
junitVersion=5.10.2
http4kVersion=5.14.4.0
http4kConnectVersion=5.10.1.0
kotlinVersion=1.9.23
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading

0 comments on commit e026c57

Please sign in to comment.