Edoardo Luppi
10/22/2023, 1:10 PMrouting {
listOrdersRoute()
getOrderRoute()
totalizeOrderRoute()
}
fun Route.listOrdersRoute() {
get("/order") {
}
}
fun Route.getOrderRoute() {
get("/order/{id}") {
}
}
fun Route.totalizeOrderRoute() {
get("/order/{id}/total") {
}
}
So basically it means we may potentially end up with a routing
section with a lot of method calls?
routing {
listOrdersRoute()
getOrderRoute()
totalizeOrderRoute()
// and maybe another hundreds
}
Edoardo Luppi
10/22/2023, 1:13 PMIf we have tons of routes in our app, this could quickly become long and cumbersome. Since we have however routes grouped by file, we can take advantage of this and define the routing in each file also. For this we could create an extension for Application and define the routes
hfhbd
10/22/2023, 3:10 PM