Created
November 3, 2017 16:24
-
-
Save wharley/ec178e3824394c155ecbd9da7e12e5e3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { graphql, buildSchema } = require('graphql') | |
// Construa um esquema, usando o idioma do esquema GraphQL | |
const schema = buildSchema(` | |
type Query { | |
hello: String | |
} | |
`) | |
// O root fornece uma função de resolução para cada endpoint da API | |
const root = { | |
hello: () => { | |
return 'Hello world!' | |
}, | |
} | |
// Execute a consulta GraphQL '{hello}' e imprima a resposta | |
graphql(schema, '{ hello }', root).then((response) => { | |
console.log(response) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment