Example subscriptions based off the prisma2 boilerplate and Ben Awad's video tutorial https://youtu.be/146AypcFvAU
yarn install
yarn start
-> open localhost:4000
mutation{
signupUser(data: {
email: "[email protected]",
name: "Prisma Sub"
}) {
email
}
}
mutation {
createDraft(
title: "Prisma Subscriptions",
content: "Subscriptions are working!"
authorEmail: "[email protected]"
) {
id,
title,
author {
email
}
}
}
# {
# "data": {
# "createDraft": {
# "id": "cjzvn2ckk0000sos951nxi6q1",
# "title": "Prisma Subscriptions"
# }
# }
# }
subscription {
publishedPost {
title,
content,
published,
author {
email
}
}
}
OR filter by email
subscription(authorEmail: "[email protected]") {
publishedPost {
title,
content,
published,
author {
email
}
}
}
# Make sure to use id from step 2
mutation {
publish(
id: "cjzvn2ckk0000sos951nxi6q1"
) {
id,
title
}
}
# {
# "data": {
# "publish": {
# "id": "cjzvn2ckk0000sos951nxi6q1",
# "title": "Prisma Subscriptions"
# }
# }
# }
# {
# "data": {
# "publishedPost": {
# "title": "Prisma Subscriptions",
# "content": "Subscriptions are working!",
# "published": true,
# "author": {
# "email": "[email protected]"
# }
# }
# }
# }
This might help prisma/prisma#454