//I first tried : fun Application.main() { routing { route("/api"){ this@routing.fooApi() this@routing.bazApi() } } } fun Routing.fooApi() { route("/foo"){ route("/bar"){ get{ DoMagic() } } } } fun Routing.bazApi() { route("/baz"){ get{ DoMagic() } } } //Which doesn't work but this does : fun Application.main() { routing { fooApi() bazApi() } } fun Routing.fooApi() { route("/api"){ route("/foo"){ route("/bar"){ get{ DoMagic() } } } } } fun Routing.bazApi() { route("/api"){ route("/baz"){ get{ DoMagic() } } } }