The graphql module exports a core subset of GraphQL functionality for creation of GraphQL type systems and servers.

import { graphql } from 'graphql'; // ES6
var { graphql } = require('graphql'); // CommonJS

Overview #

Entry Point


Type Definitions



Entry Point #

graphql #

  schema: GraphQLSchema,
  requestString: string,
  rootValue?: ?any,
  contextValue?: ?any,
  variableValues?: ?{[key: string]: any},
  operationName?: ?string
): Promise<GraphQLResult>

The graphql function lexes, parses, validates and executes a GraphQL request. It requires a schema and a requestString. Optional arguments include a rootValue, which will get passed as the root value to the executor, a contextValue, which will get passed to all resolve functions, variableValues, which will get passed to the executor to provide values for any variables in requestString, and operationName, which allows the caller to specify which operation in requestString will be run, in cases where requestString contains multiple top-level operations.

Schema #

See the Type System API Reference.

Type Definitions #

See the Type System API Reference.

Scalars #

See the Type System API Reference.

Errors #

See the Errors API Reference

Continue Reading →graphql/error