Skip to content

Commit 2a4e247

Browse files
committed
fix readme
1 parent f52716f commit 2a4e247

File tree

2 files changed

+18
-5
lines changed

2 files changed

+18
-5
lines changed

README.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
11
# @react-libraries/next-apollo-server
22

33
Package for calling ApolloServer4 from Next.js.
4+
45
'scalar Upload' is available for multipart data.
6+
The following headers need to be added to the client-side request in order for the upload to take place.
7+
8+
```ts
9+
{'apollo-require-preflight': 'true'}
10+
```
511

612
## Sample
713

@@ -16,11 +22,11 @@ Package for calling ApolloServer4 from Next.js.
1622
```ts
1723
import { promises as fs } from "fs";
1824
import { ApolloServer } from "@apollo/server";
19-
import { IResolvers } from "@graphql-tools/utils";
2025
import {
2126
executeHTTPGraphQLRequest,
2227
FormidableFile,
2328
} from "@react-libraries/next-apollo-server";
29+
import type { IResolvers } from "@graphql-tools/utils";
2430
import type { NextApiHandler, NextApiRequest, NextApiResponse } from "next";
2531

2632
/**
@@ -74,22 +80,21 @@ const resolvers: IResolvers<Context> = {
7480
const apolloServer = new ApolloServer<Context>({
7581
typeDefs,
7682
resolvers,
77-
plugins: [],
7883
});
7984
apolloServer.start();
8085

8186
/**
8287
* APIRoute handler for Next.js
8388
*/
8489
const handler: NextApiHandler = async (req, res) => {
85-
// Convert NextApiRequest to body format for GraphQL (multipart/form-data support).
90+
//Convert NextApiRequest to body format for GraphQL (multipart/form-data support).
8691
return executeHTTPGraphQLRequest({
8792
req,
8893
res,
8994
apolloServer,
9095
context: async () => ({ req, res }),
9196
options: {
92-
// Maximum upload file size set at 10 MB
97+
//Maximum upload file size set at 10 MB
9398
maxFileSize: 10 * 1024 * 1024,
9499
},
95100
});

package.json

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@react-libraries/next-apollo-server",
3-
"version": "0.0.1",
3+
"version": "0.0.3",
44
"main": "dist/index.js",
55
"license": "MIT",
66
"scripts": {
@@ -28,5 +28,13 @@
2828
"typescript": "^4.9.4"
2929
},
3030
"author": "SoraKumo <[email protected]>",
31+
"keywords": [
32+
"GraphQL",
33+
"Apollo",
34+
"Server",
35+
"Next.js",
36+
"Upload",
37+
"multipart/form-data"
38+
],
3139
"repository": "https://github.com/ReactLibraries/next-apollo-server"
3240
}

0 commit comments

Comments
 (0)