Kotlin idioms in Jooby
The bootstrap idiom comes in two flavors:
The run idiom is nice to quickly bootstrap an application, but doesn’t work well if you want to write unit and/or integration tests.
The request idiom give us implicit access to request functions and properties. So, instead of:
Works for body and form-submits too:
param, header and body idioms
Previous examples used the Java API for accessing request objects. The request idiom comes with a couple of reified functions:
The route idiom group two or more routes under a common path, like:
The class idiom is a small enhancement that allow you to provide a Kotlin class reference while adding MVC routes, requiring dependencies, etc…
Pet::class where a class reference is required, instead of
- kotlin-starter: Maven project with everything setup and ready to run.
- kotlin-gradle-starter: Gradle project with everything setup, ready to run and spek for unit and integration tests
That’s all for now. Happy Kotlin coding!