Last active
December 10, 2018 21:42
-
-
Save Angelfire/2ceeff45bd826e8fe1b980a2135ff084 to your computer and use it in GitHub Desktop.
Very Basic GraphQL
This file contains 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 { | |
GraphQLObjectType, | |
GraphQLString, | |
GraphQLSchema, | |
graphql | |
} = require('graphql'); | |
const schema = new GraphQLSchema({ | |
query = new GraphQLObjectType({ | |
name: 'Query', | |
fields: { | |
helloWorld: { | |
type: GraphQLString, | |
description: 'Hello World field', | |
resolve () { | |
return 'Hello World' | |
} | |
} | |
} | |
}) | |
}); | |
const query = ` | |
query Hello { | |
helloWorld | |
} | |
`; | |
graphql(schema, query).then(result => console.log(result)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment