-
-
Save arunoda/5c819dc4fc30f7792c68 to your computer and use it in GitHub Desktop.
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 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