This repository is a demo how to integrate a graphql endpoint based on t3n/graphql and t3n/graphql-apollofederation.
To read more about Apollo federation check out their documentation
This package includes:
- Apollo Gateway
- A flow distribution that has two graphql endpoints
/user
and/news
- A nodejs graphql endpoint
Once everything is up and running you will see a single graphql endpoint that is merged together from all three endpoints.
To get started you need to run :
# Set up flow endpoints run composer update and bring up the flow server:
cd federation-flow
composer update
./flow server:run
# Set up avatar image endpoint
cd federation-user
npm i
npm run start
# finaly start the apollo gateway
cd apollo-gateway
npm i
npm run start
Now you have a running graphql playground at localhost:4000
.
A query like
query {
allNews {
identifier
title
author {
identifier
name
avatarUrl
}
}
}
will fetch values from all three services in a single query.