The graphql
module exports a core subset of GraphQL functionality for creation
of GraphQL type systems and servers.
import { graphql } from "graphql" // ES6var { graphql } = require("graphql") // CommonJS
Entry Point
Schema
Type Definitions
class GraphQLScalarTypeA scalar type within GraphQL.
class GraphQLObjectTypeAn object type within GraphQL that contains fields.
class GraphQLInterfaceTypeAn interface type within GraphQL that defines fields implementations will contain.
class GraphQLUnionTypeA union type within GraphQL that defines a list of implementations.
class GraphQLEnumTypeAn enum type within GraphQL that defines a list of valid values.
class GraphQLInputObjectTypeAn input object type within GraphQL that represents structured inputs.
class GraphQLListA type wrapper around other types that represents a list of those types.
class GraphQLNonNullA type wrapper around other types that represents a non-null version of those types.
Scalars
Errors
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.
See the Type System API Reference.
See the Type System API Reference.
See the Type System API Reference.
See the Errors API Reference