Skip to content

Instantly share code, notes, and snippets.

@alesanabriav
Last active June 8, 2017 17:18
Show Gist options
  • Save alesanabriav/92e0bd04e275116ebbb451a6da7b81b9 to your computer and use it in GitHub Desktop.
Save alesanabriav/92e0bd04e275116ebbb451a6da7b81b9 to your computer and use it in GitHub Desktop.
const postsQuery = {
type: new GraphQLList(Post),
args: {
//to paginate
limit: { type: GraphQLInt },
offset: { type: GraphQLInt }
},
resolve(root, args, ctx) {
return Post.findAll(args);
}
};
const Query = new GraphQLObjectType({
name: "AppQueries",
description: "Root Schema",
fields: () => ({
posts: postsQuery
})
});
const Schema = new GraphQLSchema({
query: Query
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment