graphql-http / use/node
Ƭ HandlerOptions<Context
>: HandlerOptions
<Context
>
Handler options when using the node adapter.
Deprecated
Please use http or http2 adapters instead.
Name | Type |
---|---|
Context |
extends OperationContext = undefined |
▸ createHandler<Context
>(options
): (req
: IncomingMessage
, res
: ServerResponse
<IncomingMessage
>) => Promise
<void
>
Create a GraphQL over HTTP spec compliant request handler for the Node environment.
import http from 'http';
import { createHandler } from 'graphql-http/lib/use/node';
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
>
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 |
---|---|
req |
IncomingMessage |
res |
ServerResponse <IncomingMessage > |
Promise
<void
>
Category
Server/http
Deprecated