Context
Today I have a simple GraphQL stitching server that unify two graphql applications into a single graphql endpoint
AS IS
It works introspecting each service (app 1 & app 2) and building an ApolloLink
assigning a host url to each app with apollo-upload-client
and apollo-link-http
.
After this I Merge both schemas using mergeSchemas
from graphql-tools
libray.
Problem
Now I have to consume another service that is equal to app 1 but it uses another database, consequently another url, but when i instantiate the app 1 apollo-link using a diferente host the mergeSchemas ignores it and the final stitched schema continue as it initial state.
How to use the same schema with different URL's?
TO BE
I want to stitch 2 similar schemas using different url's
UPDATE
I've instantiate the schemas multiple times using different urls for each one, but this gave me duplicate schemas. whitch solves my problem but i think that there are better solutions to keep with the same schema and switch hosts by a header, for example.
Is there any better solution to keep just with 2 schemas?