From 5284542b2a972e32bd80d2b239fa55b2a19a28b7 Mon Sep 17 00:00:00 2001 From: Fatih Ozdemir <106387422+fto-dev@users.noreply.github.com> Date: Wed, 26 Feb 2025 09:08:09 +0300 Subject: [PATCH] fixed wrong variable name running-an-express-graphql-server.mdx Issue The server throws an error because the root variable is not defined. The correct variable name should be rootValue, which was previously declared in the code. Fix Updated rootValue in the createHandler function to use the correct variable name. Changes Replaced root with rootValue in the GraphQL handler configuration. --- website/pages/docs/running-an-express-graphql-server.mdx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/website/pages/docs/running-an-express-graphql-server.mdx b/website/pages/docs/running-an-express-graphql-server.mdx index 387716bb46..e01dabb922 100644 --- a/website/pages/docs/running-an-express-graphql-server.mdx +++ b/website/pages/docs/running-an-express-graphql-server.mdx @@ -23,8 +23,8 @@ const express = require('express'); // Construct a schema, using GraphQL schema language const schema = buildSchema(`type Query { hello: String } `); -// The rootValue provides a resolver function for each API endpoint -const rootValue = { +// The root provides a resolver function for each API endpoint +const root = { hello() { return 'Hello world!'; }, @@ -63,8 +63,8 @@ const schema = new GraphQLSchema({ }), }); -// The rootValue provides a resolver function for each API endpoint -const rootValue = { +// The root provides a resolver function for each API endpoint +const root = { hello() { return 'Hello world!'; },