Skip to content

Commit 3da4419

Browse files
committed
address review comments
1 parent d869a6d commit 3da4419

File tree

6 files changed

+68
-3
lines changed

6 files changed

+68
-3
lines changed

README.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -222,10 +222,11 @@ export default {
222222
};
223223
```
224224

225-
##### With [`Netlify functions`](https://docs.netlify.com/functions/overview/)
225+
##### With [`Netlify Functions`](https://docs.netlify.com/functions/overview/)
226226

227+
in `<functionsDirectory>/graphql.mjs`
227228
```js
228-
import { createHandler } from 'graphql-http/lib/use/netlify'; // npm install graphql-http
229+
import { createHandler } from 'graphql-http/lib/use/@netlify/functions'; // npm install @netlify/functions
229230
import { schema } from './previous-step';
230231

231232
// Create the GraphQL over HTTP native fetch handler

docs/README.md

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ graphql-http
1212
- [client](modules/client.md)
1313
- [common](modules/common.md)
1414
- [handler](modules/handler.md)
15+
- [use/@netlify/functions](modules/use__netlify_functions.md)
1516
- [use/express](modules/use_express.md)
1617
- [use/fastify](modules/use_fastify.md)
1718
- [use/fetch](modules/use_fetch.md)
+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
[graphql-http](../README.md) / use/@netlify/functions
2+
3+
# Module: use/@netlify/functions
4+
5+
## Table of contents
6+
7+
### Type Aliases
8+
9+
- [HandlerOptions](use__netlify_functions.md#handleroptions)
10+
11+
### Functions
12+
13+
- [createHandler](use__netlify_functions.md#createhandler)
14+
15+
## Server/netlify
16+
17+
### HandlerOptions
18+
19+
Ƭ **HandlerOptions**<`Context`\>: [`HandlerOptions`](../interfaces/handler.HandlerOptions.md)<`HandlerEvent`, `HandlerContext`, `Context`\>
20+
21+
Handler options when using the netlify adapter
22+
23+
#### Type parameters
24+
25+
| Name | Type |
26+
| :------ | :------ |
27+
| `Context` | extends [`OperationContext`](handler.md#operationcontext) = `undefined` |
28+
29+
___
30+
31+
### createHandler
32+
33+
**createHandler**<`Context`\>(`options`): `Handler`
34+
35+
Create a GraphQL over HTTP spec compliant request handler for netlify functions
36+
37+
#### Type parameters
38+
39+
| Name | Type |
40+
| :------ | :------ |
41+
| `Context` | extends [`OperationContext`](handler.md#operationcontext) = `undefined` |
42+
43+
#### Parameters
44+
45+
| Name | Type |
46+
| :------ | :------ |
47+
| `options` | [`HandlerOptions`](use__netlify_functions.md#handleroptions)<`Context`\> |
48+
49+
#### Returns
50+
51+
`Handler`

functions/graphql.mjs

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { GraphQLSchema } from 'graphql';
2+
import { createHandler } from 'graphql-http/lib/use/@netlify/functions'; // npm install @netlify/functions
3+
4+
const schema = new GraphQLSchema()
5+
6+
// Create the GraphQL over HTTP native fetch handler
7+
export const handler = createHandler({ schema });

package.json

+5
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,11 @@
6565
"require": "./lib/use/fastify.js",
6666
"import": "./lib/use/fastify.mjs"
6767
},
68+
"./lib/use/@netlify/functions": {
69+
"types": "./lib/use/@netlify/functions.d.ts",
70+
"require": "./lib/use/@netlify/functions.js",
71+
"import": "./lib/use/@netlify/functions.mjs"
72+
},
6873
"./lib/use/koa": {
6974
"types": "./lib/use/koa.d.ts",
7075
"require": "./lib/use/koa.js",

src/use/netlify.ts renamed to src/use/@netlify/functions.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import {
22
createHandler as createRawHandler,
33
HandlerOptions as RawHandlerOptions,
44
OperationContext,
5-
} from '../handler';
5+
} from '../../handler';
66

77
import type { Handler, HandlerEvent, HandlerContext } from '@netlify/functions';
88

0 commit comments

Comments
 (0)