Native server
Ktor supports Kotlin/Native and allows you to run a server without an additional runtime or virtual machine. Currently, running a Ktor server under Kotlin/Native has the following limitations:
a server should be created using
embeddedServeronly the CIO engine is supported
HTTPS without a reverse proxy is not supported
Add dependencies
Ktor server in a Kotlin/Native project requires at least two dependencies:
ktor-server-core(core dependency)ktor-server-cio(the CIO engine)
The code snippet below shows how to add dependencies to the nativeMain source set in your build.gradle.kts file:
To test a Native server, add the ktor-server-test-host artifact to the nativeTest source set:
Configure native targets
Specify the required native targets and declare a native binary using the binaries property:
Next steps
After configuring your Gradle build script, you can continue to create a Ktor server.