Hello all, I have a question about the graphql-nod...
# orm-help
m
Hello all, I have a question about the graphql-node subscription section from howtographql.com. Essentially, I’m trying to understand the .node() and why it needs parentheses, and return payload/ what is the payload? function newLinkSubscribe(parent, args, context, info) { return context.prisma.$subscribe.link({ mutation_in: ['CREATED'] }).node() } const newLink = { subscribe: newLinkSubscribe, resolve: payload => { return payload
r
Hey @Markell Richards 👋 Payload is what you send in the subscription created above:
Copy code
return context.prisma.$subscribe.link({ mutation_in: ['CREATED'] }).node()
This is what the payload would be. You can play around with that value and see that it changes based on what you return from the subscription. Also as you're getting started with Prisma, I would suggest Prisma 2 by following this as that is currently stable being actively worked on.
m
Hey @Ryan, after reading the schema-prisma file. I see that mutation_in is one of the options along with node. So this subscription is looking for any link creations and returning that. The .node() invokes the link function essentially? I’ve skimmed the prisma tutorial, I’m very familiar with react. Graphql, prisma, and Apollo are new to me. From my understanding, prisma provides the crud operations, and graphql-yoga provides the business login such as authentication , and Apollo allows React to interact with the graphql server
r
Yes you're correct about the flow.
m
Thank you for the reassurance. Been cramming a lot of material and it’s a slight change of thought compared to the mvc pattern. Does graphql-yoga work the same with prisma 2? I see howtographql is in the process of upgrading the tutorial to prisma 2.
r
The upgrade is in progress, but will be out soon 🙂 Also yes GraphQL Yoga works the same with Prisma 2, but I would suggest moving on to Nexus.
m
Thanks, I’ll check out nexus