0.4.8 • Published 7 months ago

@comity/graphql v0.4.8

Weekly downloads
-
License
MIT
Repository
github
Last release
7 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

7 months ago

0.3.0

12 months ago

0.1.2

1 year ago

0.2.0

1 year ago

0.4.5

8 months ago

0.4.4

8 months ago

0.4.7

8 months ago

0.4.6

8 months ago

0.4.1

9 months ago

0.3.2

11 months ago

0.4.0

9 months ago

0.3.1

12 months ago

0.4.3

9 months ago

0.3.4

9 months ago

0.4.2

9 months ago

0.3.3

10 months ago

0.1.1

1 year ago

0.1.0

1 year ago