Skip to content

REST API built with Kotlin, Ktor and some other real world libraries

License

Notifications You must be signed in to change notification settings

dsantarelli/kotlin-ktor-example

Repository files navigation

Kotlin Ktor Example

Branch Build Coverage
main Build Status codecov

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:

Project Structure

  + 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

Getting started

Requirements

Build:

./gradlew clean build

Start the application:

./gradlew run

The server is configured to start on port 8080.

Test:

./gradlew test

About

REST API built with Kotlin, Ktor and some other real world libraries

Topics

Resources

License

Stars

Watchers

Forks

Languages