3 unstable releases
new 0.1.1 | Nov 14, 2024 |
---|---|
0.1.0 | Nov 13, 2024 |
0.0.1 | Nov 13, 2024 |
#561 in HTTP server
132 downloads per month
89KB
2K
SLoC
Hive plugin for Apollo-Router
This project includes a Hive integration plugin for Apollo-Router.
At the moment, the following are implemented:
- Fetching Supergraph from Hive CDN
- Sending usage information from a running Apollo Router instance to Hive
This project is constructed as a Rust project that implements Apollo-Router plugin interface.
This build of this project creates an artifact identical to Apollo-Router releases, with additional features provided by Hive.
Getting Started
Binary/Docker
We provide a custom build of Apollo-Router that acts as a drop-in replacement, and adds Hive integration to Apollo-Router.
Please follow this guide and documentation for integrating Hive with Apollo Router
Library
If you are building a custom Apollo-Router with your own native plugins, you can use the Hive plugin as a dependency from Crates.io:
[dependencies]
hive-apollo-router-plugin = "..."
And then in your codebase, make sure to import and register the Hive plugin:
// import the registry instance and the plugin registration function
use hive_apollo_router_plugin::registry::HiveRegistry;
use hive_apollo_router_plugin::usage::register;
// In your main function, make sure to register the plugin before you create or initialize Apollo-Router
fn main() {
// Register the Hive usage_reporting plugin
register();
// Initialize the Hive Registry instance and start the Apollo Router
match HiveRegistry::new(None).and(apollo_router::main()) {
Ok(_) => {}
Err(e) => {
eprintln!("{}", e);
std::process::exit(1);
}
}
}
Development
- Install latest version of Rust
- To get started with development, it is recommended to ensure Rust-analyzer extension is enabled on your VSCode instance.
- Validate project status by running
cargo check
- To start the server with the demo config file (
./router.yaml
), usecargo run -- --config router.yaml
. Make sure to set environment variables required for your setup and development process (docs). - You can also just run
cargo run -- --config router.yaml --log debug --dev --supergraph some.supergraph.graphql
for running it with a test supergraph file.
Dependencies
~192MB
~4M SLoC