Branch | Build | Coverage |
---|---|---|
main |
This codebase was created to demonstrate a REST API built with Kotlin + Ktor + Kodein + Exposed including CRUD operations, routing, dependency injection and more.
The application was built with:
- Kotlin as programming language
- Ktor as web framework
- Kodein as dependency injection framework
- Jackson as data bind serialization/deserialization library
- MapStruct as mapper between types (annotation processor)
- HikariCP as datasource to abstract driver implementation
- H2 as in-memory database
- Exposed as ORM framework
- Netty as embedded application server
Testing:
- JUnit 5
- mockito-kotlin to work with Mockito in Kotlin
- ktor-web-test to call endpoints in the integration tests
- jacoco as code coverage library
+ config/
All app setups. Ktor, Kodein, Database etc.
+ dao/
Persistence layer and tables definitions
+ handlers/
Request handling business logic
+ controllers/
Classes and methods to map routes to request handlers
- App.kt <- The main class
Build:
./gradlew clean build
Start the application:
./gradlew run
The server is configured to start on port 8080.
Test:
./gradlew test