Last active
January 18, 2017 14:56
-
-
Save zgababa/b96fd27fb1764c1f8d4bd5db1d49bc01 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 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 { | |
id : '1', | |
name : 'bulbasaur', | |
order : 1, | |
sprites : { | |
front_default : "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/1.png" | |
} | |
}; | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment