All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.hexagonkt.http.server.helidon.Helidon.kt Maven / Gradle / Ivy

There is a newer version: 3.7.0
Show newest version
package com.hexagonkt.http.server.helidon

import com.hexagonkt.http.server.*
import com.hexagonkt.http.handlers.HandlerBuilder
import com.hexagonkt.http.handlers.HttpHandler

/**
 * Create a Helidon server and start it. It is a shortcut to avoid passing the adapter.
 *
 * @param settings Server settings info .
 * @param handlers List of [HttpHandler] handlers used in this server instance.
 *
 * @return The started [HttpServer] instance.
 */
fun serve(
    settings: HttpServerSettings = HttpServerSettings(), handlers: HttpHandler
): HttpServer =
    HttpServer(HelidonServerAdapter(), handlers, settings).apply { start() }

/**
 * Create a Helidon server and start it. It is a shortcut to avoid passing the adapter.
 *
 * @param settings Server settings info.
 * @param block Lambda to be used to create the list of [HttpHandler] handlers used in the server.
 *
 * @return The started [HttpServer] instance.
 */
fun serve(
    settings: HttpServerSettings = HttpServerSettings(), block: HandlerBuilder.() -> Unit
): HttpServer =
    HttpServer(HelidonServerAdapter(), HandlerBuilder().apply { block() }.handler(), settings)
        .apply { start() }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy