Skip to content

Commit dfe6e5e

Browse files
Fixed javascript code snippet
The snippet was not correct, it throws this error: Error: Expected undefined to be a GraphQL schema. The reason is that we passed configuration as params of qraphql function, but the function takes only one param - an object of the parameters. See type declaration of the function by permalink bellow https://github.com/graphql/graphql-js/blob/c7d7026982ceee536900a24ae31235127560297a/src/graphql.ts#L70
1 parent 0aaf829 commit dfe6e5e

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/content/code/language-support/javascript/server/graphql-js.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,11 @@ var schema = buildSchema(`
2323
}
2424
`);
2525

26-
var root = { hello: () => 'Hello world!' };
26+
var rootValue = { hello: () => 'Hello world!' };
2727

28-
graphql(schema, '{ hello }', root).then((response) => {
28+
var source = '{ hello }';
29+
30+
graphql({ schema, source, rootValue }).then((response) => {
2931
console.log(response);
3032
});
3133
```

0 commit comments

Comments
 (0)