0.0.0-experimental.0 • Published 1 year ago

@kingworldjs/graphql-jit v0.0.0-experimental.0

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

@kingworldjs/graphql-jit

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

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>>
}