Skip to content

Latest commit

 

History

History
68 lines (41 loc) · 1.47 KB

use_express.md

File metadata and controls

68 lines (41 loc) · 1.47 KB

graphql-http / use/express

Module: use/express

Table of contents

Interfaces

Type Aliases

Functions

Server/express

HandlerOptions

Ƭ HandlerOptions<Context>: HandlerOptions<Request, RequestContext, Context>

Handler options when using the express adapter.

Type parameters

Name Type
Context extends OperationContext = undefined

createHandler

createHandler<Context>(options): Handler

Create a GraphQL over HTTP spec compliant request handler for the express framework.

import express from 'express'; // yarn add express
import { createHandler } from 'graphql-http/lib/use/express';
import { schema } from './my-graphql-schema';

const app = express();
app.all('/graphql', createHandler({ schema }));

app.listen({ port: 4000 });
console.log('Listening to port 4000');

Type parameters

Name Type
Context extends OperationContext = undefined

Parameters

Name Type
options HandlerOptions<Context>

Returns

Handler