Skip to content

An example of using Elixir Absinthe GraphQL with Apollo Federation

License

Notifications You must be signed in to change notification settings

cogini/absinthe_federation_example_old

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AbsintheFederationExample

To start your Phoenix server:

  • Install dependencies with mix deps.get
  • Create and migrate your database with mix ecto.setup
  • Start Phoenix endpoint with mix phx.server or inside IEx with iex -S mix phx.server

Now you can visit localhost:4000 from your browser.

Ready to run in production? Please check our deployment guides.

Learn more

Rover CLI

Rover is a CLI for managing and maintaining graphs.

https://www.apollographql.com/docs/rover/

brew install rover

Fetch GraphQL server's schema via introspection

rover graph introspect http://api.example.com/graphql > api.graphql
rover graph introspect http://api2.example.com/graphql > api2.graphql

Compose a federated supergraph schema from multiple subgraphs

Create a supergraph.yml config file which identifies the back end servers and graphs:

federation_version: 2
subgraphs:
  foo:
    routing_url: https://foo.example.com/
    schema:
      file: ./foo.graphql
  bar:
    routing_url: https://bar.example.com/
    schema:
      file: ./bar.graphql

Create output supergraph schema:

rover supergraph compose --config ./supergraph.yml > supergraph.graphql

Start Apollo Router

docker-compose up router

Query router

curl --request POST --header 'content-type: application/json' --url http://localhost:4000/graphql --data '{"query":"query { __typename }"}'
curl --request POST --header 'content-type: application/json' --url http://localhost:4000/graphql --data '{"query":"query { __schema { types {name} } }"}'
curl --request POST --header 'content-type: application/json' --url http://localhost:4000/graphql --data '{"query":"query { allLinks { id url description } }"}'

Links

About

An example of using Elixir Absinthe GraphQL with Apollo Federation

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Dockerfile 53.5%
  • Elixir 40.4%
  • JSONiq 1.7%
  • JavaScript 1.6%
  • HTML 1.6%
  • Shell 1.1%
  • Other 0.1%