https://github.com/tobiasbernet/elixir_federation
Absinthe Federation Project using Apollo Federation
https://github.com/tobiasbernet/elixir_federation
absinthe apollo-federation elixir graphql
Last synced: about 1 month ago
JSON representation
Absinthe Federation Project using Apollo Federation
- Host: GitHub
- URL: https://github.com/tobiasbernet/elixir_federation
- Owner: tobiasbernet
- Created: 2021-09-10T12:16:44.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2021-09-10T12:17:28.000Z (almost 5 years ago)
- Last Synced: 2025-02-22T04:27:57.959Z (over 1 year ago)
- Topics: absinthe, apollo-federation, elixir, graphql
- Language: Elixir
- Homepage:
- Size: 179 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Elixir Federation Demo
This repository is a demo of using [Apollo Federation](https://github.com/apollographql/federation), [Elixir Absinthe](https://hexdocs.pm/absinthe/overview.html) including the [Absinthe Federation](https://hexdocs.pm/absinthe_federation/readme.html) library.
This code is highly experimental. It's is just for fun. The resolvers are not ideal but in this state I just tried to make the queries running.
It's more about learning the federation principles and testing the Elixir lib. So far I found one issue regarding the `:_resolve_reference` field.
```Elixir
# resolve(&Resolvers.User.find/3)
# raises ->
# (FunctionClauseError) no function clause matching in Absinthe.Middleware.unshim/2
# (absinthe 1.6.5) lib/absinthe/middleware.ex:293: Absinthe.Middleware.unshim([{Absinthe.Middleware.Telemetry, []}, {{Absinthe.Resolution, :call}, &AccountsWeb.Resolvers.User.find/3}], AccountsWeb.Schema)
# So we need to call the resolver in a anonymous function:
resolve(fn _, args, _ -> Resolvers.User.find(nil, args, nil) end)
```
## Run the configuration
The project runs in different `tmux` windows. You just have to run the `./startup.sh` script.
This script lunches 5 tmux windows:
`0:AccountsM 1:Inventory 2:Products 3:Reviews- 4:Apollo Gateway`