mokksy

fun Application.mokksy(server: MokksyHandler, path: String = "{...}")(source)

Installs Mokksy request handling into this Application.

Registers the SSE, DoubleReceive, and ContentNegotiation plugins (using the server's configured content negotiation) and mounts a catch-all route that dispatches every incoming request through server's stub registry.

Use this overload when you own the Application and want Mokksy to handle all routes:

embeddedServer(Netty, port = 8080) {
mokksy(server)
}.start(wait = true)

Parameters

server

The MokksyHandler whose stubs and journal will handle requests.

path

The route path pattern to mount. Defaults to "{...}" (catch-all).


fun Route.mokksy(server: MokksyHandler, path: String = "{...}")(source)

Mounts Mokksy request handling into this Route scope.

Unlike Application.mokksy, this extension does not install plugins — the caller is responsible for installing SSE, DoubleReceive, and ContentNegotiation on the surrounding Application. Pass the handler's content-negotiation setup via MokksyServer.configuration's contentNegotiationConfigurer so the serialization config matches the handler's expectations. This overload is suitable for use behind authentication or other middleware:

embeddedServer(Netty, port = 8080) {
install(SSE)
install(DoubleReceive)
install(ContentNegotiation) { server.configuration.contentNegotiationConfigurer(this) }

routing {
authenticate(AUTH_REALM) {
mokksy(server)
}
}
}.start(wait = true)

Parameters

server

The MokksyHandler whose stubs and journal will handle requests.

path

The route path pattern to mount. Defaults to "{...}" (catch-all).