From 00d7a35ed79b34042b0d102f47fc5df35db7f90a Mon Sep 17 00:00:00 2001 From: Arda TANRIKULU Date: Tue, 3 Jan 2023 03:53:12 +0300 Subject: [PATCH] Use the stable GraphQL Yoga v3 in the GraphQL example (#44488) 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 <22380829+ijjk@users.noreply.github.com> --- examples/api-routes-graphql/package.json | 2 +- examples/api-routes-graphql/pages/api/graphql.ts | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/examples/api-routes-graphql/package.json b/examples/api-routes-graphql/package.json index b06243e07d643..048932a95a353 100644 --- a/examples/api-routes-graphql/package.json +++ b/examples/api-routes-graphql/package.json @@ -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", diff --git a/examples/api-routes-graphql/pages/api/graphql.ts b/examples/api-routes-graphql/pages/api/graphql.ts index 14868f68ac7d8..aaa4305b5a49d 100644 --- a/examples/api-routes-graphql/pages/api/graphql.ts +++ b/examples/api-routes-graphql/pages/api/graphql.ts @@ -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`