Skip to content

apollosolutions/example-subgraph-rest-datasource

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Apollo Server RESTDataSource Demo

This repository demonstrates how to use RESTDataSource in an Apollo Server v4 subgraph and make the data available via the Router.

Running the Example

  • Start all the subgraphs in the /subgraphs directory
    • Install dependencies with npm install
    • Start the server and endpoints with npm start
    • Subgraph should be running at http://localhost:4001/{subgraph}/graphql
  • Start Apollo Router in the /router directory
    • Download the router by running ./download_router.sh
    • Compose the schema by running ./create_local_schema.sh
    • Run the router by running ./start_router.sh
    • You can now open the Router at http://127.0.0.1:4000/ and start querying.

Example Queries

Basic

query AllComments {
  allComments {
    id
    name
    post {
      id
      body
      user {
        id
        name
      }
    }
  }
}

About

Example ApolloServer with RESTDatasource

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published