Skip to content

Latest commit

 

History

History
179 lines (154 loc) · 4.18 KB

APIReference-GraphQL.md

File metadata and controls

179 lines (154 loc) · 4.18 KB
title layout category permalink sublinks next
graphql
../_core/GraphQLJSLayout
API Reference
/graphql-js/graphql/
graphql
/graphql-js/error/

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

Schema

Type Definitions

Scalars

Errors

Entry Point

graphql

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