Skip to content

Latest commit

 

History

History
57 lines (40 loc) · 798 Bytes

README.md

File metadata and controls

57 lines (40 loc) · 798 Bytes

Kotlin Service Approaches

Different ways to do server-side services in Kotlin

Examples cover Spring Boot, Ktor and JAX-RS

API

Each example provides the same API

GET http://localhost:8080/greeting returns a 405 with a message

GET http://localhost:8080/greeting/{name}

{
  "name": "{name}",
  "message": "Hello"
}

POST http://localhost:8080/greeting with body

{
  "name": "Name",
  "message": "Bonjour"
}

Changes the greeting message to 'Bonjour', the name is ignored.

Build & Run

Each demo is designed to be built separately.

Spring

cd spring
./mvnw clean install
java -jar target/spring-0.0.1-SNAPSHOT.jar

Ktor

cd ktor
./gradlew :run

JAX-RS (Java EE)

cd javaee
mvn clean install
java -jar target/kotlinHello.jar