I want to build a grapql server that exposes only few of dgraph generated graphql queries, mutations and subscriptions. Basically something that simply passes on the query with appropriate validation, auth etc. I would prefer https://github.com/mcollina/fastify-gql for my server but apollo is good too.
Hi @pranaypratyush,
Can you provide more details of your use case ?
In case you want auth along with graphql, Dgraph Graphql does provide an @auth directive for the purpose of authorization.
Apollo also does provide a Apollo federation gateway service which can delegate graphql requests to other graphql endpoints. It can be used to forward requests to Dgraph graphql endpoint.
Hi @pranaypratyush, I think the part of your question about fine tuning the exposed API is part of the development roadmap at least according to this.
Yes, I understand the @auth directive but I find some problems with it like the inability to expire a user token. We would like to have our own authentication mechanism on the external graphql.
I wasn’t aware that Apollo Federation is compatible with dgraph grapql. Are there any examples I can use?
The fine tuning feature would be great but right now I am just looking for a simple way to have my own graphql server sit as a gateway to dragph generated grapqhl, where I do the validation and auth and pass the query/mutation/subscription forward but not for all of them, only a subset. Apollo federation and graphql-mesh seem like good solutions but I couldn’t find dgraph specific examples or recommendations.
There was a demonstration carried out at Graphql Asia 2020 workshop. Here is the github repo.
Marking this as solution for now. @pranaypratyush if you are unsatisfied, please do respond
I did see this solution and I found it to be really messy and error prone. Are there any other solutions available?
@vardhanapoorv, do you have any other solutions ?
@pranaypratyush you can check examples here of schema merging (bit old) and a minimal Apollo federation example for the stackoverflow sample app.
I don’t have an example with GraphQL Mesh, though let me know if you face any problems while using it with Dgraph.