Created
September 3, 2016 12:17
-
-
Save rohan-varma/48bbe9ca6ab23f9049263506595d0d87 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 pokemonType = new GraphQLObjectType({ | |
name: 'pokemon', | |
fields: () => ({ | |
id: {type: GraphQLString}, | |
name: {type: GraphQLString}, | |
thumbnail: {type: GraphQLString}, | |
//our favoriteMove is a moveType, which was defined earlier. | |
favoriteMove: { | |
type: moveType, | |
resolve: (parent, _) => moves[parent.id], //defines how this query is fulfilled. | |
}, | |
//our bestFriend field is a (recursive) pokemonType. | |
bestFriend: { | |
type: pokemonType, | |
resolve: (parent, _) => friends[parent.id], | |
} | |
}), | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment