KovenServer

Singleton Koven server instance.

Usage example:

KovenServer.start {
config.port = 8081
PingContract.handle { _, _, _ -> "Pong" }
}.block()

Properties

Link copied to clipboard
Link copied to clipboard
val port: Int

Functions

Link copied to clipboard

Blocks the current thread until the server is stopped.

Link copied to clipboard
fun saveAsset(name: String, bytes: ByteArray)

Saves an asset to the KovenServerConfig.assetsPath directory.

Link copied to clipboard
fun saveFile(name: String, bytes: ByteArray)

Saves a file to the KovenServerConfig.filesPath directory.

Link copied to clipboard
fun start(server: (Int) -> ServerConfig = { JettyLoom(it) }, httpConfig: RoutingHttpHandler.() -> RoutingHttpHandler = { debug() }, serverConfig: KovenServerBuilder.() -> Unit = {}): KovenServer

Configures and starts the server.

Link copied to clipboard

Stops the server.