I have the following structure which I would consider fairly common. I've been looking and can't find any information on the recommended way for schema stitched services to call each other (while still being used by the front end). Here is my situation:
Api Gateway schema stitches:
- Users Service
- Posts Service
The posts service uses mongodb and the users service uses PostgreSQL. The posts service's schema only includes the user_id and not the full user. When I need a page of posts (with the corresponding user information) I am calling the users service using node-fetch from within the getPosts resolver in the posts service like so:
{
getUsers(user_id__in:[1,5,9,3]){
username
join_date
}
}
This solution feels kind of "dirty" compared to how elegant the rest of the apollo-graphql has been.
Is it more typically to ignore the graphql portions for resolving data and use the typical rest endpoint structure provided by apollo-graphql's underlying express server? If not should I be calling the other services directly or calling them through the api gateway? If I should be calling them through the api gateway is there a way any built in elegant way of calling the api gateway using some Apollo functionality (since the services are schema stitched).