Skip to content

williamhaw/federation-demo-caliban

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

federation-demo-caliban

This repository reimplements Apollo's federation-demo using Scala and Caliban.

Contents

Service Api Server
Accounts AccountsApi AccountsServer
Reviews ReviewsApi ReviewsServer
Products ProductsApi ProductsServer
Inventory InventoryApi InventoryServer

Requirements

  • sbt > 1.x
  • recent version of npm and node

Setup and Run

  1. Run all servers by starting the sbt shell:
     > sbt
  2. Inside the sbt shell, run:
    ...
    [info] started sbt server
    sbt:federation-demo-caliban> run AllServers
    
  3. In the repository root, run
    > npm install
  4. Then run
    > npm run start-gateway
  5. Navigate to http://localhost:4000 in your preferred browser.
  6. To observe traces with OpenTelemetry, run Jaeger with:
    docker run -d --name jaeger \
     -e COLLECTOR_ZIPKIN_HOST_PORT=:9411 \
     -p 5775:5775/udp \
     -p 6831:6831/udp \
     -p 6832:6832/udp \
     -p 5778:5778 \
     -p 16686:16686 \
     -p 14250:14250 \
     -p 14268:14268 \
     -p 14269:14269 \
     -p 9411:9411 \
     jaegertracing/all-in-one:1.29
    Then navigate to http://localhost:16686/. Run queries and observe the traces being logged.
  7. Close both gateway and services by hitting Ctrl-C.

Example Queries

query ExampleQuery {
  me {
    id
    name
    username
    reviews {
      body
      product {
        name
      }
    }
  }
  topProducts(first: 3) {
    upc
    name
    price
    weight
    inStock
    shippingEstimate
    reviews {
      body
      author {
        name
        username
      }
    }
  }
}

Notes

  • AccountsServer uses Play to serve GraphQL Playground and run the GQL interpreter. The other servers use Akka HTTP directly.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors