summaryrefslogtreecommitdiffhomepage
path: root/app/controllers/api/v1/games_controller.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/controllers/api/v1/games_controller.rb')
-rw-r--r--app/controllers/api/v1/games_controller.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/app/controllers/api/v1/games_controller.rb b/app/controllers/api/v1/games_controller.rb
new file mode 100644
index 0000000..073eec9
--- /dev/null
+++ b/app/controllers/api/v1/games_controller.rb
@@ -0,0 +1,18 @@
+class Api::V1::GamesController < ApplicationController
+ skip_before_action :verify_authenticity_token
+ def create
+ puts request.methods.sort
+ @game = Game.new(games_params)
+ if @game.save
+ render json: @game, status: :created
+ else
+ render json: @game.errors, status: :unprocessable_entity
+ end
+ end
+
+ private
+
+ def games_params
+ params.require(:game).permit(:title, :game_file)
+ end
+end