start

fun start(options: WebServerOptions, onServerStarted: (Stoppable) -> Unit = {}, onServerReady: suspend () -> Unit = {}, wait: Boolean = false): Unit?

Starts the web server which serves the specified file and allows for live reloading.

Parameters

options

options to start the server with

onServerStarted

callback invoked once the server is bound and ready, with the handle that can later stop it. Callers should hold on to this handle to distinguish "server is running" from later reload cycles.

onServerReady

callback invoked once the server is ready to accept reload triggers. Typically used to push an initial reload so any browser tab that was already open (waiting for the SSE endpoint) refreshes immediately.

wait

if true, blocks the caller until the server stops. Useful for standalone server invocations (quarkdown start) where there is nothing else keeping the process alive.