All the info I find is about Apollo client, with no information as to how this should work on the server.
I guess this is the way to do it...? I just thought maybe there was a simpler way:
type Post {
comments: CommentContainer
}
type CommentContainer {
edges: [CommentEdge],
cursor: String,
}
type CommentEdge {
node: Comment
}
Resolvers:
Post: {
comments(post, args, ctx) {
return Post.find({ PostId: post.id })
},
},
CommentContainer: {
cursor() {
return "...";
},
edges(container, args, ctx) {
return container;
}
},
CommentEdge: {
node(edges, args, ctx) {
return edges;
},
}
Edit: the proper terminology is connection rather than "container".
@scf4 yeah, that's the way to do connections. graphql-tools doesn't contain any special helpers for this (yet?).
Most helpful comment
@scf4 yeah, that's the way to do connections. graphql-tools doesn't contain any special helpers for this (yet?).