Created
January 31, 2019 21:59
-
-
Save hendrikniemann/b8292db0850c2180427d7982e7fdc049 to your computer and use it in GitHub Desktop.
Minimal GraphQL Example
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 { ApolloServer } = require('apollo-server'); | |
| const { GraphQLSchema, GraphQLObjectType, GraphQLString } = require('graphql'); | |
| const Query = new GraphQLObjectType({ | |
| name: 'Query', | |
| description: 'The query operation entry type.', | |
| fields: { | |
| hello: { | |
| type: GraphQLString, | |
| description: 'Our first query field, how exciting!', | |
| resolve: () => "world!", | |
| }, | |
| }, | |
| }); | |
| const schema = new GraphQLSchema({ query: Query }); | |
| const server = new ApolloServer({ schema }); | |
| server.listen(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment