Server

data class Server(adapter: ServerPort, router: Router, settings: ServerSettings)

Server that listen to HTTP connections on a port and address and route requests using a router.

Constructors

Link copied to clipboard
fun Server(adapter: ServerPort, settings: ServerSettings = ServerSettings(), block: Router.() -> Unit)

Create a server with a router. It is a combination of Server and Router.

Link copied to clipboard
fun Server(adapter: ServerPort, router: Router, settings: ServerSettings = ServerSettings())

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
fun start()

Start the server with the adapter instance and adds a shutdown hook for stopping the server.

Link copied to clipboard
fun started(): Boolean

Check whether the server has been started.

Link copied to clipboard
fun stop()

Stop the server.

Properties

Link copied to clipboard
val contextRouter: Router

Provide a Router instance configured with the context path in ServerSettings.

Link copied to clipboard
val portName: String

The port name of the server.

Link copied to clipboard
val runtimePort: Int

Runtime port of the server.

Link copied to clipboard
val settings: ServerSettings