Documentationgraphql-http

graphql-http

The official graphql-http package provides a simple way to create a fully compliant GraphQL server. It has a handler for Node.js native http, together with handlers for well-known frameworks like Express, Fastify and Koa; as well as handlers for different runtimes like Deno and Bun.

graphql-http is a companion package, not part of the graphql npm package’s API surface. This page preserves the GraphQL.js docs context and points to the official project for full server, client, and compliance documentation.

Official Resources

Express

import { createHandler } from 'graphql-http/lib/use/express';

createHandler

function createHandler({
  schema,
  rootValue,
  context,
  formatError,
  validationRules,
}: {
  rootValue?: any;
  context?: any;
  formatError?: Function;
  validationRules?: any[];
}): Handler;

Constructs an Express handler based on a GraphQL schema.

See Running an Express GraphQL Server for sample usage.

See graphql-http.com and the GitHub README for more extensive documentation, including how to use graphql-http with other server frameworks and runtimes.