Simple ktor jackson example.
- Ktor 1.5.0
- Kotlin 1.4.21-2
- JUnit 5.7.0
- assertk 0.23
- Docker
- GitHub Actions (CI)
- Java 11
- Maven >= 3.2.1 (Kotlin comes as maven dependency)
$ git clone https://github.com/larmic/ktor-demo
$ mvn clean verify
# build application
$ mvn clean package -DskipTests
# start application
$ java -jar target/ktor-*-with-dependencies.jar
# build application
$ mvn clean package -DskipTests
# build docker image
$ docker build -t larmic/ktor-demo-jvm -f src/main/docker/Dockerfile.jvm .
# start application
$ docker run -i --rm -p 8080:8080 larmic/ktor-demo-jvm
# HTTP request examples
# Get root
$ curl --request GET http://localhost:8080/
# Get all tasks
$ curl -i -H "Content-Type: application/json" --request GET http://localhost:8080/tasks
# Get one task
$ curl -i -H "Content-Type: application/json" --request GET http://localhost:8080/tasks/1