graph-gophers / graphql-go

GraphQL server with a focus on ease of use
BSD 2-Clause "Simplified" License
4.64k stars 491 forks source link

Apollo subgraph example #603

Closed pavelnikolov closed 1 year ago

pavelnikolov commented 1 year ago

fixes: #602 fixes: #528

In order to test:

  1. Pull the master branch
  2. Run cd example/apollo_federation/subgraph
  3. Run go run server.go
  4. Open http://localhost:8080 in your browser
  5. Test with a query like this:
    query subgraph{
      post(id: "3") {
        id
        title
      }
      _entities(representations: ["{\"__typename\": \"Post\", \"id\": \"3\"}"]) {
        __typename
        ... on Post {
          id
          title
        }
      }
      _service {
        sdl
      }
    }
Screenshot 2023-03-02 at 14 16 47