Class: GraphqlController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/graphql_controller.rb

Instance Method Summary collapse

Instance Method Details

#executeObject



4
5
6
7
8
9
10
11
12
13
14
# File 'app/controllers/graphql_controller.rb', line 4

def execute
  variables = ensure_hash(params[:variables])
  query = params[:query]
  operation_name = params[:operationName]
  context = {
    # Query context goes here, for example:
    # current_user: current_user,
  }
  result = Binda::Api::Schema.execute(query, variables: variables, context: context, operation_name: operation_name)
  render json: result
end