graphql-framework-experiment icon indicating copy to clipboard operation
graphql-framework-experiment copied to clipboard

Relay Server Spec compliant example with nexus

Open outerlook opened this issue 4 years ago • 3 comments

What

Is there any available example of building common features that are compliant to relay server spec with nexus?

Why

  • I'm trying to migrate my frontend to relay for some perf/structure issues, then I'm getting some hard time figuring out how to make somethings work, (pagination, global identification, separated input Objects, Mutation payloads). There are information about this but too spread out there, and I don't know if I'm not searching well, but I didn't find any example that uses prisma or nexus generating a relay compliant server.

  • I read the docs where there's info about how to use connectionField. There are some parts that would be really nice to understand where did something come from as ctx.users.resolveForConnection for example, and how different case my server is.

How

  • It would be really useful to have an example on building a relay compliant server

Here's a gist showing how I implemented some parts, which I've not even tested, just to keep this available if some of it is useful https://gist.github.com/outerlook/c88a98335f976bba0a51db9de135f0c5

I really appreciate your work. Thank you

outerlook avatar Mar 24 '20 19:03 outerlook

Hey @outerlook have you looked at https://www.nexusjs.org/#/api/modules/main/exports/schema?id=tconnection.

jasonkuhrt avatar May 26 '20 23:05 jasonkuhrt

I'm also in the process of implementing a Relay-compliant GraphQL server using Nexus (@nexus/schema only to be more specific), and I have been creating a few plugins to help with that, you can find them here https://github.com/JCMais/nexus-plugins

JCMais avatar Aug 05 '20 02:08 JCMais

@JCMais fyi @Weakky just worked on this area. You two should talk :)

https://github.com/vercel/next.js/pull/15752

jasonkuhrt avatar Aug 05 '20 03:08 jasonkuhrt