Skip to content

Latest commit

 

History

History
49 lines (41 loc) · 1.01 KB

README.md

File metadata and controls

49 lines (41 loc) · 1.01 KB

@kingworldjs/graphql-jit

An experimental plugin for kingworld that adds support for using GraphQL JIT.

EXPERIMENTAL: DO NOT USE

Installation

bun add graphql @kingworldjs/graphql-jit

Example

import { KingWorld } from 'kingworld'
import { graphql } from '../src'

const app = new KingWorld()
    .get('/', () => 'Hi')
    .post('/mirror', (context) => context.body)
    .use(graphql, {
        resolvers: {
            Query: {
                hello: () => 'Hello world!'
            }
        },
        schema: `
            type Query {
                hello: String
            }`
    })
    .listen(8080)

path

@default "/graphql"

Path to expose as GraphQL handler

schema

GraphQL schema

resolvers

Resolvers funcitons

resolvers: {
    Query?: Record<string, Function | Promise<Function>>
    Mutation?: Record<string, Function | Promise<Function>>
    Subscription?: Record<string, Function | Promise<Function>>
}