Plugin to compose your Tartiflette Graphql service in an Apollo federation
Project description
See https://github.com/remorses/tartiflette-apollo-federation-example for an example
For now the plugin only supports simple sharing of types with the same fields and merging of the query and mutation fileds,
In the near future there will be support for the @key
directive and a new @ResolveReference('TypeName')
decorator to resolve the types between servers, similar to how Apollo __resolveReference
works.
To suggest other better api ideas on how to implement __resolveReference
open a issue.
Installation
pip install tartiflette_plugin_apollo_federation
Usage
from tartiflette_aiohttp import register_graphql_handlers
from tartiflette_plugin_apollo_federation import ApolloFederationPlugin
def run():
engine_sdl = "./sdl/"
app = register_graphql_handlers(
app=web.Application(),
engine_sdl=engine_sdl,
engine_modules=[
ApolloFederationPlugin(engine_sdl=engine_sdl)
],
executor_http_endpoint="/graphql",
graphiql_enabled=True,
)
web.run_app(app, port=PORT)
run()
Then use xmorse/apollo-federation-gateway
to glue together your services
version: '3'
services:
service1:
build: ./service1
service2:
build: ./service2
gateway:
image: xmorse/apollo-federation-gateway
ports:
- 8000:80
environment:
URL_0: "http://service1:8001/graphql"
URL_1: "http://service2:8002/graphql"
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Hashes for tartiflette_plugin_apollo_federation-0.0.6.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | ab4fbfc43955e0ac7a84addeb9a35f4e64ef1fe5184c3090cf1dcd0291fdf7c8 |
|
MD5 | 0b05bb47abf8a3310542a3982dab8c53 |
|
BLAKE2b-256 | b3ec0e675405e78557187c534e5a14e116603297c66b605de0778cea17eb7ed7 |