Skip to content

Commit 6b253e7

Browse files
authored
fixed wrong variable name (#4351)
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.
1 parent 1437cda commit 6b253e7

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

website/pages/docs/running-an-express-graphql-server.mdx

+4-4
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ const express = require('express');
2323
// Construct a schema, using GraphQL schema language
2424
const schema = buildSchema(`type Query { hello: String } `);
2525

26-
// The rootValue provides a resolver function for each API endpoint
27-
const rootValue = {
26+
// The root provides a resolver function for each API endpoint
27+
const root = {
2828
hello() {
2929
return 'Hello world!';
3030
},
@@ -63,8 +63,8 @@ const schema = new GraphQLSchema({
6363
}),
6464
});
6565
66-
// The rootValue provides a resolver function for each API endpoint
67-
const rootValue = {
66+
// The root provides a resolver function for each API endpoint
67+
const root = {
6868
hello() {
6969
return 'Hello world!';
7070
},

0 commit comments

Comments
 (0)