This is an example of using GraphQL federation with python. This includes multiple python graphql servers and a federated gateway.
Each server is made up of a default set of components
All data asociated with the User User - http://localhost:8300
All data asociated with the Photo Photo - http://localhost:8301
All data asociated with the Review Review - http://localhost:8302
Gateway - http://localhost:4000
To run this demo
docker-compose up --build
The Query Browser will run at http://localhost:4000 this is where you can test queries.
The config will also allow you yo use the individual GraphQL servers.
This will connect all of the GraphQL Schemas with one query.
query {
users(first_name:"Han"){
id
first_name
last_name
photos{
id
url
reviews{
id
title
body
}
}
}
}
{
"data": {
"users": [
{
"id": "100",
"first_name": "Han",
"last_name": "Solo",
"photos": [
{
"id": "1000",
"url": "https://upload.wikimedia.org/wikipedia/en/thumb/b/be/Han_Solo_depicted_in_promotional_image_for_Star_Wars_%281977%29.jpg/220px-Han_Solo_depicted_in_promotional_image_for_Star_Wars_%281977%29.jpg",
"reviews": [
{
"id": "10000",
"title": "Great Photo",
"body": "Lorem Ipsum Set Adore, Lorem Ipsum Set Adore, Lorem Ipsum Set Adore, Lorem Ipsum Set Adore, Lorem Ipsum Set Adore, "
}
]
},
{
"id": "1001",
"url": "https://pbs.twimg.com/media/BlrdTeMIQAAN1rv.jpg",
"reviews": [
{
"id": "10001",
"title": "Great Photo",
"body": "Lorem Ipsum Set Adore, Lorem Ipsum Set Adore, Lorem Ipsum Set Adore, Lorem Ipsum Set Adore, Lorem Ipsum Set Adore, "
}
]
}
]
}
]
}
}