The ability to reply to discussions is limited to PRO members. Want to join in the discussion? Click here to subscribe now.

Add a Relay Node Interface to a GraphQL Schema

Add a Relay Node Interface to a GraphQL Schema

7:00
The GraphQL Relay Specification requires that a GraphQL Schema has some kind of mechanism for re-fetching an object. For typical Relay-compliant servers, this is going to be the `Node` Interface. In this video, we’ll add in the `Node` interface to a GraphQL Schema by using the helpers available in the `graphql-relay` `npm` package.
Watch this lesson now
Avatar
egghead.io

The GraphQL Relay Specification requires that a GraphQL Schema has some kind of mechanism for re-fetching an object. For typical Relay-compliant servers, this is going to be the Node Interface. In this video, we’ll add in the Node interface to a GraphQL Schema by using the helpers available in the graphql-relay npm package.

Avatar
Sébastien

Great series, first 11 videos go smoothly. Once at 12 and 13, the assumption about prior knowledge (here Relay) is pretty high and the learning curve is a lot steeper. Probably a good time to read about Relay and come back later...

In reply to egghead.io
Avatar
Josh Black

Glad to hear the first 11 videos went well! But am definitely sorry about the jump when we start talking about Relay-specific concepts for GraphQL.

The goal was to be able to take the server we build out in this course and use it together with React/Relay. Unfortunately, in order to make sure that works we had to tackle the three big concepts for Relay-compliant GraphQL Servers:

  • Node identification
  • Connections
  • Mutations

If you're curious about a place to start to learn more about Relay and GraphQL, a great place to start with these topics is the Relay Docs.

If you're looking for additional resources, let me know! I can definitely provide any help on topics that are underdeveloped during this course.

In reply to Sébastien
Avatar
Alex

Josh, what a great series. I finally feel like I have a solid grasp on GraphQL and most importantly what problems it solves. I'm in the same boat as OP, everything prior to this video I consumed, digested, and understood. In this video I definitely feel lost, I'll check out the Relay docs to try to get a better understanding.

I just wanted to add a comment here in case there are considerations for expounding on some of the concepts in this video.

In reply to Josh Black
Avatar
Josh Black

Hi Alex! Just wanted to say thanks for watching the course, and thanks so much for the feedback. I'm sorry that this video made you feel lost, and I'd love to hear what concepts in particular would be useful to cover prior to this video to make sure the transition to the last couple videos is smoother.

Thanks again for watching! Glad to hear it was helpful 😄

In reply to Alex
Avatar
Theo

Hey Josh, im getting the same error "Abstract type Node must resolve to an Object type at runtime for field QueryType.node with value \"[object Object]\", received \"undefined\"." even when redefining the const videotype in the second function. Checked the source code and my videoType is exactly the same as yours, any idea why this is still persisting?

In reply to Josh Black
Avatar
Josh Black

Sorry to hear that, Theo! If you could share your project through GitHub I could definitely take a look to help debug.

In reply to Theo
Avatar
Chris

The reason for the error at the end is that you created a circular import. I already felt this could lead to problems when you did that in lesson 12...

Avatar
Josh Black

Hi Chris! Glad to see you spotted the error 😄.

In this series, the hope was to try and emulate an issue that I've found to be common when people are starting out with GraphQL. In this case, the error would be that circular import like you described previously.

Awesome to see that you caught it, but I also wanted to walk through solving the problems for others who might end up in a similar situation to what was crafted in the video.

In reply to Chris
Avatar
Ignacio Ureta

WTF. I know it's not your bad, but man... i could understand everything to this point, but now it's just too cryptic.

HEY, QUICK QUESTION!
Joel's Head
Why are we asking?