Organizing routes in Ktor
In this section, we'll see what the idiomatic approach in Ktor is for structuring multiple routes that belong to the same domain.
Our current routing
block looks like this:
routing { get("/status") { ... } post("/cats") { ... } get("/cats") { … } get("/cats/{id}") { ... } }
It would be good if we could extract all the routes that are related to cats into a separate file. Let's start by replacing all the cat routes with a function:
routing { ...