Skip to content

Ktor server which works on Kotlin/JVM and Kotlin/Native with the help of Kotlin Multiplattform

Notifications You must be signed in to change notification settings

jonas-tm/ktor-multi-target-server

Repository files navigation

ktor-multi-target-server

This repository contains a proof-of-concept for developing a Ktor server in with Kotlin Multiplatform targeting Kotlin/Native and Kotlin/JVM.

The core server logic including routes and plugins lays in commonMain module. The platform specific Ktor Engine, Configuration and SQLDelight Drivers are implemented in the respective target modules commonNative and commonMain.

Features

  • Ktor Plugins
  • Different engines per target (Netty -> JVM, CIO -> Native)
  • SQLDelight SQLite Persistence

Run/Debug

  • Config path to SQLite database in com.jonastm.EnvironmentImpl.kt per target module
  • Kotlin/JVM gradle :run
    • (not working for some unknown reason -> start via IntelliJ main func)
  • Kotlin/Native
    • Debug: gradle :runDebugExecutableNative
    • Run: gradle :runReleaseExecutableNative

Tests

Tests are implemented in commonTest and can be run for both platforms.

  • Kotlin/JVM via gradle :jvmTest
  • Kotlin/Native via gradle :nativeTest
  • All targets via gradle :allTests

About

Ktor server which works on Kotlin/JVM and Kotlin/Native with the help of Kotlin Multiplattform

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages