Simple routing

It is the easiest way to add all the URLs and their corresponding functions. The only catch is that there is no separation of concern, which means that the code is not self-dependent and not modular either.

Example:

    get("/") {      call.respondText("Hello readers!", ContentType.Text.Html)    }

In this case, the URL pattern and its action (function) are specified in the application file.

Get Kotlin Blueprints now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.