Ktor plugin for graphql-kotlin.
Also provides subscriptions implementation for protocols graphql-ws and graphql-transport-ws.
- graphql-kotlin-ktor-plugin - Ktor plugin
- graphql-kotlin-ktor-subscriptions - GraphQL subscriptions implementation for Ktor
- example - Ktor server example
dependencies { implementation("io.github.darkxanter.graphql", "graphql-kotlin-ktor-plugin", "<last-version>") }fun Application.configureGraphQLModule() { install(ContentNegotiation) { jackson() } install(CallLogging) install(WebSockets) install(GraphQLKotlin) { queries = listOf( HelloQueryService(), ) subscriptions = listOf( SimpleSubscription() ) schemaGeneratorConfig { supportedPackages = listOf("example.graphql") } generateContextMap { request -> val loggedInUser = User( email = "johndoe@example.com", firstName = "John", lastName = "Doe", ) mapOf( "AuthorizedContext" to AuthorizedContext(loggedInUser) ) } } }