VulcanJS / Vulcan

🌋 A toolkit to quickly build apps with React, GraphQL & Meteor
http://vulcanjs.org
MIT License
7.96k stars 1.89k forks source link

GraphQL schema merging, stitching & bindings #1936

Closed MathiasKandelborg closed 5 years ago

MathiasKandelborg commented 6 years ago

This issue is created to aggregate resources and links about merging a remote schema into Vulcan. It can hopefully clarify how and when you'd want to do different things with graphql in Vulcan.

Vulcan primarily uses Apollo as it's GraphQL implementation.

Incorporating a remote schema into an existing one


GraphQl resolvers

First and foremost: please go check out this video. That being said, the whole playlist/series is a really good introduction to Apollo and GraphQL and how to use it in practice.

When you make a resolver with GraphQl, you can have it resolve anything. A good example of this is getting a users profile image when they've logged in with Facebook.

You create a resolver that hits Facebooks 'Graph API' with the new user's facebook id and include the picture field. After receiving results from the fetch, the resolver can return a string with the image URL.

A bit more interactive: Go to the API, make a query, look at the bottom right, press 'get code' and then on the curl. Without the token, a request for your own picture looks like this: https://graph.facebook.com/v2.12/me?fields=id%2Cname%2Cpicture&access_token=<missing token>


Using GraphQL bindings

I've just begun reading about bindings and can't claim any real knowledge. Any resources and thoughts you have on the subject are appreciated.

Resources

Importing .graphql files

You can make a gql string in the file you're using graphql with graphql-tools and have it be used just like any .graphql import.

stale[bot] commented 6 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.