Altair Rails is a Rails engine that provides a mountable endpoint for the Altair GraphQL Client.
Add this line to your Gemfile:
gem "altair-rails"
Or install the latest version with RubyGems:
gem install altair-rails
Source code can be downloaded as part of the project on GitHub:
By default the Altair GraphQL Client is mounted at /altair
. It can be configured by adding an initializer to your Rails application:
Altair::Rails.configure do |config|
# Where you want to mount the engine in your application. If set to nil,
# the engine will not be mounted automatically and it will need to be
# mounted manually. E.g.: in your routes.rb file, adding:
# mount Altair::Rails::Engine => "/altair"`
config.mount_at = "/altair"
# The path to your GraphQL endpoint. This is used to set the endpointURL.
config.graphql_path = "/graphql"
# The path to your ActionCable endpoint. This is used to set the
# subscriptionsEndpoint.
config.action_cable_path = "/cable"
# Any options you want to pass to AltairGraphQL.init(). For more details:
# https://github.com/altair-graphql/altair/blob/f433ee1bf6c52c8639b6448fa7e0c31c6ad955d1/packages/altair-core/src/config.ts
config.altair_options = {}
end
I created this project after battling GraphQL subscriptions, and GraphiQLs lack of support for ActionCable.
That being said, there are still great projects worth checking out:
- graphiql-rails - A Rails engine that provides a mountable endpoint for GraphiQL.
This project is released under the MIT license:
Copyright 2023 jejacks0n