Anthony Giniers
@antogyn
@aginiers
GraphQL :
Back-end
https://slides.com/antogyn/graphql-backend
type Query { human(id: ID!): Human } type Human { id: ID! name: String! friends: [Human] }
Comment implémenter ce schéma ?
const Resolvers = { Query: { human(_, { id }) { return getHumanById(id); }, }, Human: { id(human) { return human.id; }, name(human) { return human.name; }, friends(human) { return getFriendsOfHuman(human.id); }, }, };
1 resolver/champ
Un resolver a trois arguments :
const Resolvers = { Query: { human(_, { id }) { return getHumanById(id); }, }, Human: { friends(human) { return getFriendsOfHuman(human.id); }, }, };
https://github.com/antogyn/graphql-simple-backend
Questions ?
By antogyn
XKE 09/05/2017