Modular routing

With modular routing, we separate the URL handling logic into different files for easier maintenance and to achieve a separation of concern.

For example:

    install(Routing) {      newsSources()      newsArticles()    }

In this case, we just specify the list of functions to handle the routing, while the actual routing logic is defined in a different location or file. 

We are adding these routes to our Routing module. Hence we need to create extension functions on the Route class to understand that it contains URL mapping (routing).

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.