apollographql / rover

The CLI for Apollo GraphOS
https://rover.apollo.dev
Other
404 stars 84 forks source link

Connect to a public api schema via local host using Apollo router, rover and GQL Federation #1998

Open Priya-dev opened 1 month ago

Priya-dev commented 1 month ago

Description

Is there a way to connect to a public API schema (starwars or spaces api's) using a supergraph or subgraph through your local host? Further, can I introspect the schema on rover cli? Also, can I introspect that on a localhost:4000/graphQL.

I have basically searched Apollo docs, youtube, and even blogs but didn't find any method to connect to a public API from a local host.

What are you trying to accomplish? What have you tried? Let us know any info relevant to your question, and we'll try our best to answer!

smyrick commented 1 month ago

Yes, you can either introspect a public schema (star wars) with rover dev if the schema is available: https://www.apollographql.com/docs/rover/commands/dev

rover dev --name starwars --url https://swapi-graphql.netlify.app/.netlify/functions/index

Or you can manually download the public schemas and compose them together with rover supergraph compose and then run the supergraph with rover dev: https://www.apollographql.com/docs/rover/commands/supergraphs#composing-a-supergraph-schema

LongLiveCHIEF commented 3 weeks ago

Are you talking about utilizing a local proxy to connect to an endpoint? I've opened a feature request for that in router (see https://github.com/apollographql/router/issues/5809). Rover uses the router binary when using rover dev.