Skip to content

Instantly share code, notes, and snippets.

@arunoda
Created October 29, 2015 05:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arunoda/5c819dc4fc30f7792c68 to your computer and use it in GitHub Desktop.
Save arunoda/5c819dc4fc30f7792c68 to your computer and use it in GitHub Desktop.
const Post = new GraphQLObjectType({
name: 'Post',
fields: () => ({
id: {type: GraphQLString},
title: {type: GraphQLString},
author: {type: Author},
})
});
const Author = new GraphQLObjectType({
name: 'Author',
fields: () => ({
id: {type: GraphQLString},
name: {type: GraphQLString},
})
});
const RootQuery = new GraphQLObjectType({
name: 'RootQuery',
fields: () => ({
recentPost: {
type: Post,
resolve(root, args, info) {
....
}
}
})
});
const schema = new GraphQLSchema({
query: RootQuery
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment