Skip to content

Demo of using Apollo tools to connect a GraphQL endpoint to a RESTful endpoint

Notifications You must be signed in to change notification settings

speedingplanet/graphql-rest-apollo-demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GraphQL and REST demo

Mostly borrowed from the excellent Get Started with Apollo Connectors and GraphOS guide at the Apollo GraphQL website. If there's anything wrong in the current repo's documentation, you should DEFINITELY go to the link above and try running this code from scratch.

Requirements

Rover: Available here. I used the curl installer, so I cannot vouch for other install methods.

Getting started

  • Clone the repo
  • Open a terminal
  • Run the commands below: replace [API KEY GOES HERE] with the API key I provided via e-mail.
APOLLO_KEY=service:[API KEY GOES HERE] \
  APOLLO_GRAPH_REF=Ecomm-Example-39rb5@main \
  APOLLO_ROVER_DEV_ROUTER_VERSION=2.0.0 \
  rover dev --supergraph-config supergraph.yaml

You should see output that ends with something like this:

==> Attempting to start router at http://localhost:4000.
==> Health check exposed at http://127.0.0.1:8088/health
WARN: Connector debugging is enabled, this may expose sensitive information.
==> Your supergraph is running! head to http://localhost:4000 to query your supergraph

You should be able to open http://localhost:4000 and see the familiar Apollo Sandbox. Try out some queries!

Behind the scenes

The products subgraph in products.graphql is running queries against https://ecommerce.demo-api.apollo.dev/products. That URL should bring up a products endpoint and serve several product represenations. You can visit https://ecommerce.demo-api.apollo.dev/products/1, as is typical, to see the details of the product with the ID 1.

About

Demo of using Apollo tools to connect a GraphQL endpoint to a RESTful endpoint

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published