0.4.8 • Published 5 months ago

@comity/graphql v0.4.8

Weekly downloads
-
License
MIT
Repository
github
Last release
5 months ago

Comity Graphql Handler

A Hono middleware for handling GraphQL requests, seamlessly integrated with Envelop to provide enhanced GraphQL server capabilities.

Features

  • High Performance: Built on Hono, ensuring minimal overhead and blazing-fast performance.
  • Extensible: Leverage Envelop plugins to enhance your GraphQL server with features like caching, tracing, error handling, and more.
  • Lightweight: Designed to be simple and efficient, with a focus on developer experience.

Installation

# with NPM
npm install @comity/graphql
# or with YARN
yarn add @comity/graphql
# or with PNPM
pnpm add @comity/graphql

Usage

import { Hono, type Context } from 'hono';
import {
  buildSchema,
  execute,
  parse,
  subscribe,
  validate,
  specifiedRules,
} from 'graphql';
import { graphqlHandler } from '@comity/graphql';
import { useLogger, useEngine, useSchema } from '@envelop/core';

const app = new Hono();
const schema = buildSchema(`
  type Query {
    hello: String
  }
`);

const rootResolver = (c: Context) => {
  return {
    hello: () => 'Hello World!',
  };
};

app.use(
  '/graphql',
  graphqlHandler({
    schema,
    rootResolver,
    plugins: [
      useLogger(),
      useEngine({ parse, validate, specifiedRules, execute, subscribe }),
      useSchema(schema),
    ],
  })
);

app.fire();

Credits

Based on the original work by Minghe Huang.

0.4.8

5 months ago

0.3.0

10 months ago

0.1.2

11 months ago

0.2.0

10 months ago

0.4.5

6 months ago

0.4.4

6 months ago

0.4.7

5 months ago

0.4.6

6 months ago

0.4.1

7 months ago

0.3.2

8 months ago

0.4.0

7 months ago

0.3.1

10 months ago

0.4.3

7 months ago

0.3.4

7 months ago

0.4.2

7 months ago

0.3.3

8 months ago

0.1.1

12 months ago

0.1.0

12 months ago