Skip to content

Instantly share code, notes, and snippets.

@zgababa
Last active January 18, 2017 14:56
Show Gist options
  • Save zgababa/b96fd27fb1764c1f8d4bd5db1d49bc01 to your computer and use it in GitHub Desktop.
Save zgababa/b96fd27fb1764c1f8d4bd5db1d49bc01 to your computer and use it in GitHub Desktop.
'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