You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am looking for best practices on how to use Apollo Server Federation with Gremlin and a gateway. I noticed a lot of the examples show how to fetch data from a REST API by using resolvers to fetch child data by ID (looping the children), but there is not a lot of examples on how to do it with a graph database.
For example, I want to share the Role type from the Role Service to the User Service. I want to simply re-use the type definition but not have the code hop back to the Role Service to resolve it. This is to avoid the extra queries. There could be a lot of extra queries if the user has a lot of roles. To sum it up, I want the User Service to resolve both the User and Role types via a Gremlin query without having to copy the Role Type to the User Service.
Here is the Gremlin query joining one User with many roles via an out edge.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hello Apollo Community 👋,
I am looking for best practices on how to use Apollo Server Federation with Gremlin and a gateway. I noticed a lot of the examples show how to fetch data from a REST API by using resolvers to fetch child data by ID (looping the children), but there is not a lot of examples on how to do it with a graph database.
For example, I want to share the
Role
type from theRole Service
to theUser Service
. I want to simply re-use the type definition but not have the code hop back to theRole Service
to resolve it. This is to avoid the extra queries. There could be a lot of extra queries if the user has a lot of roles. To sum it up, I want theUser Service
to resolve both theUser
andRole
types via a Gremlin query without having to copy the Role Type to the User Service.Here is the Gremlin query joining one User with many roles via an out edge.
Gremlin
User Type (in User Service port 4001)
Role Type (In Role Service port 4002)
Any guidance or links to articles would be greatly appreciated!
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions