Part 2: Accessing the webservice with KTor client

In the last post Part 1 we created a simple webservice for organising tasks. This time we will access this service using the KTor client features. Setting up For this tutorial we will use gradle with kotlin dsl to build the application. mkdir kotlin_ktor_client cd kotlin_ktor_client gradle init --dsl kotlin plugins { application kotlin("jvm") version "1.3.0" } application { mainClassName = "client.ClientKt" } dependencies { compile(kotlin("stdlib")) compile("io.ktor:ktor-client-core:1.0.0") compile("io.ktor:ktor-client-apache:1.0.0") } repositories { mavenCentral() jcenter() } // We need this task to package the client into a jar task("packageClient", type = Jar::class) { from(configurations.
Read more...

Part 1: Building a simple web service with KTor

Ktor recently reached version 1.0.0 which motivated me to write this blog post. In this tutorial we will create a simple webservice for adding and listing tasks using the Kotlin framework Ktor. Ktor is a framework to build asynchronous server and client applications. Setting up For this tutorial we will use gradle with kotlin dsl to build the test application. mkdir kotlin_ktor cd kotlin_ktor gradle init --dsl kotlin plugins { application kotlin("jvm") version "1.
Read more...