Understanding route paths

Sometimes building a routing tree by hand can be very inconvenient. Hence, there is the path, which is a parameter to the route function, that is processed to build routing trees. First, it is split into path segments by the / delimiter. Each segment generates a nested routing node. These two variants are equivalent:

    // Variant 1    route("/foo/bar") { … }
    // Variant 2    route("/foo") {      route("bar") { … }    }

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.