Skip to content

Commit

Permalink
fix: fix graphql example to work with graphql@16 (elastic#3735)
Browse files Browse the repository at this point in the history
  • Loading branch information
trentm authored and peter-ei committed Aug 20, 2024
1 parent 1699741 commit 2a4cba2
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions examples/trace-graphql.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const schema = buildSchema(`
`);

// The root provides a resolver function for each API endpoint
const root = {
const rootValue = {
hello: () => {
return 'Hello world!';
},
Expand All @@ -38,10 +38,10 @@ const root = {
const t1 = apm.startTransaction('t1');

// Run the GraphQL query '{ hello }' and print out the response
graphql(schema, '{ hello }', root).then((response) => {
graphql({ schema, source: '{ hello }', rootValue }).then((response) => {
console.log('hello response:', response);
});
graphql(schema, '{ bye }', root).then((response) => {
graphql({ schema, source: '{ bye }', rootValue }).then((response) => {
console.log('bye response:', response);
t1.end();
});

0 comments on commit 2a4cba2

Please sign in to comment.