http4k
See sample-http4k for a project using the http4k integration.
Add galak-http4k to your project
Make sure to follow the steps in “Getting started” first to generate your
ServiceExecutableSchemaBuilder.
To use the http4k integration, add galak-http4k to your dependencies and the http4k bom:
dependencies { // Add the runtime dependency implementation("net.mbonnin.galak:galak-http4k:0.0.0")
implementation(platform("org.http4k:http4k-bom:5.8.0.0")) implementation("org.http4k:http4k-core") // This sample uses netty but you can use any other supported backend // See https://www.http4k.org/guide/reference/servers/ implementation("org.http4k:http4k-server-netty")}galak-ktor provides an galakHandler(ExecutableSchema) function that handles the /graphql route:
val executableSchema = ServiceExecutableSchemaBuilder().build()galakHandler(executableSchema) .asServer(Netty(8000)) .start() .block()
ServiceExecutableSchemaBuilderis generated by the KSP processor. See “Getting started” for more details.