TheHorizian

Ktor for Mobile Developers: Is it Easy to Learn Server Side Coding? Part-1

Backend for mobile engineers with Kotlin and Ktor

1. Lightweight:

2. Extensible:

3. Multiplatform:

4. Asynchronous:

1. Generate a Ktor project:

2. Plugin for IntelliJ IDEA:

The project structure directory
dependencies {
implementation “io.ktor:ktor-server-core:$ktor_version”
implementation “io.ktor:ktor-server-netty:$ktor_version”
implementation “ch.qos.logback:logback-classic:$logback_version”
implementation “io.ktor:ktor-serialization:$ktor_version”
testImplementation “io.ktor:ktor-server-tests:$ktor_version”
}
To start the server click on run button.
2021–03–25 14:13:28.803 [main] INFO Application — Autoreload is disabled because the development mode is off.2021–03–25 14:13:29.156 [main] INFO Application — Responding at http://0.0.0.0:8080
This localhost page can’t be found
fun Application.module(testing: Boolean = false) {
routing {
get("/") {
call.respondText("HELLO WORLD!", contentType = ContentType.Text.Plain)
}
/*---------------------*/
post { }
put { }
delete { }
}

}

routing:

get:

call:

Android Developer | Kotlin Developer | Open-Source Enthusiast | Part-time Blogger | 💻 🚘 🎸 enthusiast

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store