Skip to content

Latest commit

 

History

History
46 lines (29 loc) · 1.04 KB

use_express.md

File metadata and controls

46 lines (29 loc) · 1.04 KB

graphql-http / use/express

Module: use/express

Table of contents

Functions

Server/express

createHandler

createHandler<Context>(options): Handler

Create a GraphQL over HTTP Protocol 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<Request<ParamsDictionary, any, any, ParsedQs, Record<string, any>>, undefined, Context>

Returns

Handler