HotReloadServer

Hot reloading server. Watches for changes on the classpath source and rebuilds the project when changes are detected. Uses an event source connection script injected into the HTML pages to trigger a reload when the project is rebuilt.

Functions

Link copied to clipboard
inline fun <T : HotReloadable<H>, H> hotReload(watcher: PathWatcher, taskRunner: TaskRunner, reload: Reload<H>, noinline log: (String) -> Unit, noinline err: (String) -> Unit, crossinline toServer: (H) -> Http4kServer): Http4kServer
Link copied to clipboard
inline fun <H : HotReloadable<HttpHandler>> http(serverConfig: ServerConfig = SunHttp(8000), watcher: PathWatcher = ProjectCompilingPathWatcher(Gradle()), taskRunner: TaskRunner = retry(5, ofMillis(100)), noinline log: (String) -> Unit = ::println, noinline error: (String) -> Unit = System.err::println): Http4kServer

Create a hot-reloading HTTP server. Defaults to SunHttp on port 8000.

Link copied to clipboard
inline fun <H : HotReloadable<PolyHandler>> poly(serverConfig: PolyServerConfig, watcher: PathWatcher = ProjectCompilingPathWatcher(Gradle()), taskRunner: TaskRunner = retry(5, ofMillis(100)), noinline log: (String) -> Unit = ::println, noinline error: (String) -> Unit = System.err::println): Http4kServer

Create a hot-reloading Multi-protocol server.