mercurius-js / mercurius

Implement GraphQL servers and gateways with Fastify
https://mercurius.dev/
MIT License
2.33k stars 234 forks source link

make url dynamic so even if the graphiql is deployed on baseUrl it can work. #1037

Closed glg-satish-tripathi closed 9 months ago

glg-satish-tripathi commented 9 months ago

fix - https://github.com/mercurius-js/mercurius/issues/1003 issue.

The graphiql failed to load schema when it's been deployed on https://foo.com/bar/graphiql, it will look for the schema at https://foo.com/graphql but it's actually running on https://foo.com/bar/graphql, which is an invalid graphql endpoint as it is missing window.baseUrl. So we are addressing this in the PR.

image

Thank you @ddai1 for help here.

glg-satish-tripathi commented 9 months ago

@mcollina Please review and approve these changes. I'm currently working on a GraphQL API, and without these modifications, I won't be able to deploy the setup. I'm not an expert in JavaScript, so I'm uncertain about where, if at all, unit tests should be added.