A middleware for integrating Hubburu with Apollo server
npm install hubburu
These are the integration points you need to make to integrate with Hubburu.
- Add your API key
- Upload schema SDL to Hubburu
- Send operation reports to Hubburu
Register for Hubburu, and you will be able to access your API Key from there. The recommended way is to add it to your environment variables. You can also add it manually to the Hubburu SDK calls.
Either you can upload your schema on server startup. This is an OK way to do it but not suitable for all environments. If you want to manually send it (such as in a CI/CD pipeline), you can do so like this:
const { pushHubburuSchema } = require("hubburu");
const schema = graphql.buildClientSchema(introspectionResult); // or get an instance of graphql.GraphQLSchema some other way.
pushHubburuSchema({ schema })
.then(() => console.log("Schema pushed to hubburu"))
.catch((e) => {
console.error(e);
process.exit(1);
});
This is done by adding the Hubburu middleware to the list of Apollo middlewares. Example:
import { HubburuApolloServerPlugin } from "hubburu";
const server = new ApolloServer({
schema,
plugins: [
HubburuApolloServerPlugin({
contextToRequestId: (context) => context.requestId,
}),
],
});
This plugin is being developed and tested in another repository. You are welcome to send bug reports either as an issue on Github or to hello@hubburu.com.