graphql-http / use/uWebSockets
Ƭ HandlerOptions<Context
>: HandlerOptions
<HttpRequest
, RequestContext
, Context
>
Handler options when using the http adapter.
Name | Type |
---|---|
Context |
extends OperationContext = undefined |
▸ createHandler<Context
>(options
): (res
: HttpResponse
, req
: HttpRequest
) => Promise
<void
>
Create a GraphQL over HTTP spec compliant request handler for the Node environment uWebSockets.js module.
import uWS from 'uWebSockets.js'; // yarn add uWebSockets.js@uNetworking/uWebSockets.js#<version>
import { createHandler } from 'graphql-http/lib/use/uWebSockets';
import { schema } from './my-graphql-schema';
uWS
.App()
.any('/graphql', createHandler({ schema }))
.listen(4000, () => {
console.log('Listening to port 4000');
});
Name | Type |
---|---|
Context |
extends OperationContext = undefined |
Name | Type |
---|---|
options |
HandlerOptions <Context > |
fn
▸ (res
, req
): Promise
<void
>
Name | Type |
---|---|
res |
HttpResponse |
req |
HttpRequest |
Promise
<void
>