graphql:install
Add an initial setup to your application with configuration, schema, folder structure, and routes.Usage
Arguments
The name of the schema to create
Options
Where to put the GraphQL files
Skip creating .keep files and respective folders
Skip adding GraphQL routes
What It Creates
The install generator creates the following structure:Generated Routes
The following routes are added toconfig/routes.rb:
config/routes.rb
Configuration File
The generator createsconfig/initializers/graphql.rb with common settings:
config/initializers/graphql.rb
The install generator automatically invokes the
graphql:schema generator to create your main schema file.graphql:schema
Create a new GraphQL schema inside thegraphql folder.
Usage
Arguments
The name of the schema to create
Options
Where to put the schema file
Generated Schema
app/graphql/sample_schema.rb
GraphQL::Schema and is ready for customization with queries, mutations, and subscriptions.
Learn more about schemas
Understand how to configure and customize your GraphQL schemas
graphql:controller
Create a new controller that handles GraphQL requests with theGraphQL::Controller concern.
Usage
Arguments
The name of the controller to create
Generated Controller
app/controllers/sample_controller.rb
GraphQL::Controller concern provides methods for:
- Executing GraphQL queries
- Handling introspection requests
- Serving GraphiQL interface
- Managing request context
Customize your controller
Learn how to customize the GraphQL controller for your needs
graphql:channel
Create a new Action Cable channel for GraphQL subscriptions with theGraphQL::Channel concern.
Usage
Arguments
The name of the channel to create
Generated Channel
app/channels/sample_channel.rb
GraphQL::Channel concern enables real-time GraphQL subscriptions over WebSockets using Action Cable.
Customize your channel
Explore channel customization options for subscriptions