Class: AtlasEngine::GraphqlController

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

Instance Method Summary collapse

Instance Method Details

#executeObject



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'app/controllers/atlas_engine/graphql_controller.rb', line 11

def execute
  variables = prepare_variables(params[:variables])
  query = params[:query]
  operation_name = params[:operationName]
  context = {
    # Query context goes here, for example:
    # current_user: current_user,
  }
  result = Schema.execute(query, variables: variables, context: context, operation_name: operation_name)
  render(json: result)
rescue StandardError => e
  raise e unless Rails.env.development?

  handle_error_in_development(e)
end