- clone this repo.
- npm install
- npm start
- Go to localhost: 4000 on your browser to own graphQL playground.
You can do the following:
- query
- mutation
- subscription
- Currently, using a fake data (no database used)
type Subscription {
post: PostSubscriptionPayload!
comment(postId: ID!): CommentSubscriptionPayload!
}
enum MutationType {
CREATED
UPDATED
DELETED
}
type PostSubscriptionPayload {
mutation: MutationType!
data: Post!
}
type CommentSubscriptionPayload {
mutation: MutationType!
data: Comment!
}
Examples below
pubsub.publish('post', {
post: {
mutation: 'CREATED',
data: post
}
});
pubsub.publish(`comment ${args.data.post}`, {
comment: {
mutation: 'CREATED',
data: comment
}
});