graphql-http / use/http
Ƭ HandlerOptions<Context
>: HandlerOptions
<IncomingMessage
, RequestContext
, Context
>
Handler options when using the http adapter.
Name | Type |
---|---|
Context |
extends OperationContext = undefined |
▸ createHandler<Context
>(options
): (req
: IncomingMessage
, res
: ServerResponse
) => Promise
<void
>
Create a GraphQL over HTTP spec compliant request handler for the Node environment http module.
import http from 'http';
import { createHandler } from 'graphql-http/lib/use/http';
import { schema } from './my-graphql-schema';
const server = http.createServer(createHandler({ schema }));
server.listen(4000);
console.log('Listening to port 4000');
Name | Type |
---|---|
Context |
extends OperationContext = undefined |
Name | Type |
---|---|
options |
HandlerOptions <Context > |
fn
▸ (req
, res
): Promise
<void
>
Name | Type |
---|---|
req |
IncomingMessage |
res |
ServerResponse |
Promise
<void
>