Ktor Server Auto-Routing
Kobold uses Kotlin Symbol Processing (KSP) to build upon Ktor Type Safe Routing.
Kobold will maintain your ktor server routing based on class structures so all you need in your ktor server setup is:
Kobold will detect any class annotated with @Resource
and @Kobold
and add it to the autoRouter() function:
By extending KPost<T, R>
you direct Kobold to create a POST
route for /login
which will accept T
as the post body and respond with R
. T
implements KRequest
and R
implement KResponse
.
AuthRouter
will capture the request and processes it via a lambda to your personal process
implementation.
The resulting route will look like this:
Routing can get very complex as your app grows and Kobold will keep it clean for you. Learn more about using Sealed Subclasses to maintain hierarchy.