Apollo Kotlin Execution Help

http4k

To use the http4k integration, add apollo-execution-http4k to your dependencies and the http4k bom:

dependencies { // Add the runtime dependency implementation("com.apollographql.execution:apollo-execution-http4k:0.1.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") }

apollo-execution-ktor provides an apolloHandler(ExecutableSchema) function that handles the /graphql route:

val executableSchema = ServiceExecutableSchemaBuilder().build() apolloHandler(executableSchema) .asServer(Netty(8000)) .start() .block()
Last modified: 29 August 2024