Altair Express Middleware is an active and frequently updated Express.js middleware designed to serve the Altair GraphQL Client UI. Currently at version 8.5.2, it provides a convenient way to self-host the full-featured Altair GraphQL Client within an Express application, allowing developers to interact with GraphQL APIs directly from their server. Recent releases, such as v8.5.0, introduced significant enhancements like Zod validation for initialization options and plugin schemas, and v8.2.8 brought stricter Content Security Policy (CSP) enforcement with nonces, improving security. The package aims for a regular release cadence to align with the main Altair GraphQL Client, offering features like query execution, schema introspection, and subscription support. Its key differentiator is the tight integration with the comprehensive Altair client experience, contrasting with simpler embedded GraphQL explorers.
npm install altair-express-middlewareVerified import paths — ran on the pinned version, not inferred.
Demonstrates setting up a basic Express server with a placeholder GraphQL endpoint and integrating the Altair GraphQL Client UI middleware, accessible at `/altair`.
Review your `altairExpress` options and ensure they strictly conform to the expected types and structure. Consult the official documentation or `AltairExpressOptions` type definition for correct usage.
If you use custom CSPs, ensure you retrieve and include the nonce provided by the middleware in your `script-src` and `style-src` directives. Alternatively, configure your CSP to allow Altair's embedded scripts and styles, or carefully consider disabling strict CSP if not required for your environment.
Ensure your Node.js environment is updated to version 12 or higher to meet the minimum engine requirements for the package.
Carefully check the `altairExpress` configuration against the `AltairExpressOptions` type definition or the official documentation. Ensure all properties are correct, correctly typed, and conform to the new validation rules.
Modify your server's CSP headers to explicitly allow the nonce generated by Altair. If using `helmet` or similar middleware, you might need to configure it to allow nonces or to relax the CSP for the Altair path.
Ensure `app.use('/altair', altairExpress(...))` is present in your Express application's configuration and that your server is successfully listening on the correct port. Verify that the URL path `/altair` matches where you intend to access the Altair client.