EmbeddedServer

Represents an embedded server that hosts an application. It's an entry point to the application and handles the lifecycle of the application engine.

Report a problem

Type Parameters

TEngine

The type of the application engine used by the server.

TConfiguration

The type of the configuration used by the engine.

Represents an embedded server that hosts an application. It's an entry point to the application and handles the lifecycle of the application engine.

Report a problem

Type Parameters

TEngine

The type of the application engine used by the server.

TConfiguration

The type of the configuration used by the engine.

Represents an embedded server that hosts an application. It's an entry point to the application and handles the lifecycle of the application engine.

Report a problem

Type Parameters

TEngine

The type of the application engine used by the server.

TConfiguration

The type of the configuration used by the engine.

Represents an embedded server that hosts an application. It's an entry point to the application and handles the lifecycle of the application engine.

Report a problem

Type Parameters

TEngine

The type of the application engine used by the server.

TConfiguration

The type of the configuration used by the engine.

Constructors

Link copied to clipboard
expect constructor(rootConfig: ServerConfig, engineFactory: ApplicationEngineFactory<TEngine, TConfiguration>, engineConfigBlock: TConfiguration.() -> Unit = {})
actual constructor(rootConfig: ServerConfig, engineFactory: ApplicationEngineFactory<TEngine, TConfiguration>, engineConfigBlock: TConfiguration.() -> Unit)
actual constructor(rootConfig: ServerConfig, engineFactory: ApplicationEngineFactory<TEngine, TConfiguration>, engineConfigBlock: TConfiguration.() -> Unit)
actual constructor(rootConfig: ServerConfig, engineFactory: ApplicationEngineFactory<TEngine, TConfiguration>, engineConfigBlock: TConfiguration.() -> Unit)

Properties

Link copied to clipboard
Link copied to clipboard
expect val engine: TEngine
actual val engine: TEngine
actual val engine: TEngine
actual val engine: TEngine
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
expect val monitor: Events

Provides events on Application lifecycle

actual val monitor: Events

Provides events on Application lifecycle

actual val monitor: Events

Provides events on Application lifecycle

actual val monitor: Events

Provides events on Application lifecycle

Functions

Link copied to clipboard
fun EmbeddedServer<*, *>.addShutdownHook(stop: () -> Unit)

Registers a stop block that runs when the process receives a termination signal (JVM shutdown hook on JVM, POSIX signal on Native, process event on JS). Should be called before starting the server.

Link copied to clipboard
fun reload()

Reload application: stop the current instance first, then create a replacement.

Link copied to clipboard
expect fun start(wait: Boolean = false): EmbeddedServer<TEngine, TConfiguration>
Link copied to clipboard
expect suspend fun startSuspend(wait: Boolean = false): EmbeddedServer<TEngine, TConfiguration>
Link copied to clipboard
expect fun stop(gracePeriodMillis: Long = engineConfig.shutdownGracePeriod, timeoutMillis: Long = engineConfig.shutdownTimeout)
actual fun stop(gracePeriodMillis: Long, timeoutMillis: Long)
fun stop(shutdownGracePeriod: Long, shutdownTimeout: Long, timeUnit: TimeUnit)
actual fun stop(gracePeriodMillis: Long, timeoutMillis: Long)
actual fun stop(gracePeriodMillis: Long, timeoutMillis: Long)
Link copied to clipboard
expect suspend fun stopSuspend(gracePeriodMillis: Long = engineConfig.shutdownGracePeriod, timeoutMillis: Long = engineConfig.shutdownTimeout)
actual suspend fun stopSuspend(gracePeriodMillis: Long, timeoutMillis: Long)
actual suspend fun stopSuspend(gracePeriodMillis: Long, timeoutMillis: Long)
actual suspend fun stopSuspend(gracePeriodMillis: Long, timeoutMillis: Long)