Kotlin Routing new core release after months š
⢠You can now send and receive body objects to avoid parameters limitations
⢠Check whether a route can be handled by RouteMethod too
⢠Redirect to another route that haven't the same RouteMethod.
https://github.com/programadorthi/kotlin-routing/releases/tag/0.0.18
š 2
h
hallvard
08/07/2024, 6:46 AM
How about implementing the possibility to define all routes in one place in a compact manner? In the Play framework, one sets out with one line per route, resulting in a very compact and neat overview of all the routes in an application: https://www.playframework.com/documentation/3.0.x/JavaRouting#The-routes-file-syntax
Having the possibility to define all routes of an app with this Play!-syntax in Ktor (or via Kotlin Routing) would be a very nice feature, both for me, who have been wanting it for a long time, and for others who might be tempted to migrate from Play! to Ktor.
(just my two pennies' worth.)
t
Thiago
08/08/2024, 12:02 AM
Nice feature. But as Kotlin Routing is fully based on Ktor, when it supports I think a can support too.
How Play Framework reads and tranforms route file syntax to real Java objects? Do it by reflection?
h
hallvard
08/08/2024, 6:22 AM
I am unaware of how the Play framework does it. They're heavily depending on scala, and when I compile a Play project, a lot of intermediate files appear that I have never bothered looking at. But defining all paths in a server project in one single file, one line per path, gives an extremely compact overview of the server!
Simply generating the needed DSL from a list of paths before anything else happens could be done with a compiler plugin, I guess ...
Well, as I said, this was just a thought. And I haven't thought it through. š
t
Thiago
08/12/2024, 7:42 PM
I understood. It would be nice to implement, but I'm keeping things close to Ktor to be familiar for devs using Ktor Server or Client. š
Thiago
11/18/2024, 2:35 PM
Instead of declaring like Play Framework, now you can use annotations to have a close behavior. Checkout here.