Last active
January 22, 2017 13:29
-
-
Save zgababa/6f451972204a576c0d2aac60efee64fc 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
'use strict'; | |
const graphql = require('graphql'); | |
const client = require('./pokemon.client'); | |
const pokemonType = new graphql.GraphQLObjectType({ | |
name : 'PokemonType', | |
fields : { | |
id : { | |
type : graphql.GraphQLString | |
}, | |
name : { | |
type : graphql.GraphQLString | |
}, | |
order : { | |
type : graphql.GraphQLInt | |
}, | |
img : { | |
type : graphql.GraphQLString, | |
resolve : (pokemon) => pokemon.sprites.front_default | |
} | |
} | |
}); | |
module.exports = { | |
type : pokemonType, | |
args : { | |
id : { | |
type : graphql.GraphQLInt | |
} | |
}, | |
resolve : (root, args) => { | |
return client.getPokemon(args.id); | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment