Skip to content

Instantly share code, notes, and snippets.

@hendrikniemann
Created January 31, 2019 21:59
Show Gist options
  • Select an option

  • Save hendrikniemann/b8292db0850c2180427d7982e7fdc049 to your computer and use it in GitHub Desktop.

Select an option

Save hendrikniemann/b8292db0850c2180427d7982e7fdc049 to your computer and use it in GitHub Desktop.
Minimal GraphQL Example
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