diff --git a/app/controllers/index_controller.rb b/app/controllers/index_controller.rb index 1417139d6..40c364f17 100644 --- a/app/controllers/index_controller.rb +++ b/app/controllers/index_controller.rb @@ -11,4 +11,9 @@ def index # def routing_error # fail ActionController::RoutingError # end + + def method_not_allowed + response.set_header('Allow', 'POST') + render json: { "message": "This endpoint only supports POST requests." }.to_json, status: :method_not_allowed + end end diff --git a/config/routes.rb b/config/routes.rb index d811383cf..d4c621b75 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,5 +1,7 @@ Rails.application.routes.draw do post "/graphql", to: "graphql#execute" + get "/graphql", to: "index#method_not_allowed" + root :to => 'index#index' # authentication