Ktor API development

Ishrat khan
2 min readMar 31, 2020

Ktor is a framework for building asynchronous servers and clients in connected systems using the powerful Kotlin programming language.

Developing API is very easy with Ktor,I started learning Ktor few weeks back.I would like to give simple and easiest steps to develop Ktor API. In this article only basics are discussed.

Setup your project as given on official sites https://ktor.io/quickstart/index.html and follow steps listed here.

All the code and required documentations , Sample projects are available on this repo, one of the best repo available for Ktor development.

A little information about Ktor Project Architecture

Detail is available at this link https://ktor.io/servers/application.html#

Application

An Application instance is the main unit of a Ktor Application.

Features

A feature is a singleton (usually a companion object) that you can install and configure for a pipeline.

Modules

A Ktor module is just a user-defined function receiving the Application class that is in charge of configuring the server pipeline, install features, registering routes, handling requests, etc.

ApplicationCall

The ApplicationCall provides access to two main properties ApplicationRequest and ApplicationResponse. As their names indicate, they correspond to the incoming request and outgoing response

Above is very basic information about Ktor but it’s required when you decide to develop API using Ktor.

Don’t forget to watch this video https://www.youtube.com/watch?v=V4PS3IjIzlw

I will come back with a very complex API example wait for it :-).

Thank you for reading…

--

--

Ishrat khan
Ishrat khan

Written by Ishrat khan

Senior Android Engineer @ Nect

No responses yet