Skip to content

Instantly share code, notes, and snippets.

@helfer
Last active January 14, 2020 21:12
Show Gist options
  • Save helfer/c5750955cb0c37f3f79dd2ab2d4dcc6e to your computer and use it in GitHub Desktop.
Save helfer/c5750955cb0c37f3f79dd2ab2d4dcc6e to your computer and use it in GitHub Desktop.
const resolvers = {
Query: {
author(root, args){
return { id: 1, firstName: 'Hello', lastName: 'World' };
},
},
Author: {
posts(author){
return [
{ id: 1, title: 'A post', text: 'Some text', views: 2},
{ id: 2, title: 'Another post', text: 'Some other text', views: 200}
];
},
},
Post: {
author(post){
return { id: 1, firstName: 'Hello', lastName: 'World' };
},
},
};
export default resolvers;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment