Ktor 1.5.3 Help


A Ktor Application consists of a series of one or more modules, each of which can house any kind of functionality.

App Diagram

Module Diagram

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.

You have to specify the modules to load when the server starts in the application.conf file.

A simple module function would look like this:

package com.example.myapp fun Application.mymodule() { routing { get("/") { call.respondText("Hello World!") } } }

Of course, you can split the module function in several smaller functions or classes.

Modules are referenced by their fully qualified name: the fully qualified name of the class and the method name, separated by a dot (. ).

So for the example, the module's fully qualified name would be:

Last modified: 03 February 2021