Skip to content

Commit

Permalink
Use the stable GraphQL Yoga v3 in the GraphQL example (vercel#44488)
Browse files Browse the repository at this point in the history
Use the stable GraphQL Yoga v3 in the GraphQL example, and also disable body parser for fully functionality as in GraphQL Yoga's recipe for Next.js;
https://the-guild.dev/graphql/yoga-server/docs/integrations/integration-with-nextjs#example


Co-authored-by: JJ Kasper <[email protected]>
  • Loading branch information
ardatan and ijjk authored Jan 3, 2023
1 parent 3dfb85d commit 00d7a35
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion examples/api-routes-graphql/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"start": "next start"
},
"dependencies": {
"graphql-yoga": "three",
"graphql-yoga": "^3.2.1",
"graphql": "^16.5.0",
"next": "latest",
"react": "^18.2.0",
Expand Down
7 changes: 7 additions & 0 deletions examples/api-routes-graphql/pages/api/graphql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,13 @@ const schema = createSchema({
resolvers,
})

export const config = {
api: {
// Disable body parsing (required for file uploads)
bodyParser: false,
},
}

export default createYoga({
schema,
// Needed to be defined explicitly because our endpoint lives at a different path other than `/graphql`
Expand Down

0 comments on commit 00d7a35

Please sign in to comment.