David Beer
10/23/2025, 3:04 PMclass JettyConfig(private val port: Int) : ServerConfig {
override fun toServer(http: HttpHandler): Http4kServer {
val server = Server().apply {
insertHandler(http.toJettyHandler())
}
return object : Http4kServer {
override fun start(): Http4kServer = apply { server.start() }
override fun stop(): Http4kServer = apply { server.stop() }
override fun port(): Int = port
}
}
}
And Called using App.app.asServer(JettyConfig(App.port)).start()dave
10/23/2025, 3:12 PMhttp4k-server-xyz
the module.
There are plenty of examples in here, including using http4k-config for typesafe configuration:
https://github.com/http4k/examples
https://github.com/http4k/http4k-by-exampleDanielZ
10/23/2025, 5:39 PMdave
10/23/2025, 5:43 PMDanielZ
10/23/2025, 5:46 PMdave
10/23/2025, 5:46 PMDavid Beer
10/24/2025, 8:25 AMDavid Beer
10/24/2025, 8:26 AMdave
10/24/2025, 8:26 AMdave
10/24/2025, 8:27 AM