Setting up the build script
We will be using the Gradle build system for our project.
Adding Kotlin dependency
Kotlin language is added as a Gradle dependency in the project:
// Kotlin compile "org.jetbrains.kotlin:kotlin-stdlib-jre8:$kotlin_version"
Adding Ktor dependencies
The Ktor
file is located on bintray
and it has a dependency on the coroutines library available in kotlinx
, so we will need to add the following repositories to the repositories block:
maven { url "http://dl.bintray.com/kotlin/ktor" } maven { url "https://dl.bintray.com/kotlin/kotlinx" }
We will add an extra property for holding the value of the latest version of Ktor:
ext.ktor_version = '0.9.0-alpha1'
Now add the ktor-core
dependency in our build.gradle
:
// ktor compile "io.ktor:ktor:$ktor_version"
As we discussed earlier, Ktor can be deployed in various environments. For our news feed application, we will use Netty as our server by adding an extra dependency:
compile "io.ktor:ktor-server-netty:...