Example of Client-Server application written on pure Kotlin.
Server is an example of RestAPI developed with Ktor.
It has only two endpoints defined in
server/src/.../Routing.kt
.
To run local use:
./gradlew installDist
export PORT=8080
./server/build/install/server/bin/server
Repository also provide continuous deployment to Heroku (see Procfile
).
Client is a web application written in Kotlin/JS
.
It provides simple HTML form with an input and submit button.
Each submit sends POST request to server and shows its response.
At first, setup server url in client/src/.../Api.kt
To run local use:
./gradlew runBrowser
Client would start on localhost:80.
Also, client provides docker-based usage:
# 1. Build web application
./gradlew browserProductionWebpack
# 2. Build docker (copy sources into NGINX home directory)
docker build -t my-client-application .
# 3. Start docker in daemon mode
docker run -it -d --rm -p 80:80 --name daemon-client my-client-application
# To stop client
docker stop daemon-client