Skip to content

Commit

Permalink
Add boilerplate for questions, tags & categories
Browse files Browse the repository at this point in the history
  • Loading branch information
ksashikumar committed Jun 9, 2017
1 parent ba91f60 commit d95f9e0
Show file tree
Hide file tree
Showing 8 changed files with 75 additions and 0 deletions.
18 changes: 18 additions & 0 deletions app/controllers/categories_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
class CategoriesController < ApplicationController

def create
end

def index
end

def show
end

def update
end

def destroy
end

end
18 changes: 18 additions & 0 deletions app/controllers/questions_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
class QuestionsController < ApplicationController

def create
end

def index
end

def show
end

def update
end

def destroy
end

end
18 changes: 18 additions & 0 deletions app/controllers/tags_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
class TagsController < ApplicationController

def create
end

def index
end

def show
end

def update
end

def destroy
end

end
3 changes: 3 additions & 0 deletions app/serializers/base_serializer.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
class BaseSerializer < ActiveModel::Serializer
attributes :id
end
2 changes: 2 additions & 0 deletions app/serializers/question_serializer.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
class QuestionSerializer < BaseSerializer
end
2 changes: 2 additions & 0 deletions app/serializers/tag_serializer.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
class TagSerializer < BaseSerializer
end
2 changes: 2 additions & 0 deletions app/serializers/user_serializer.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
class UserSerializer < BaseSerializer
end
12 changes: 12 additions & 0 deletions config/routes.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
Rails.application.routes.draw do

api_routes = proc do
resources :questions do
end
resources :categories do
end
resources :tag do
end
end

scope '/api', defaults: { version: 'v1', format: 'json' }, constraints: { format: /(json|$^)/ } do
scope '/v1', &api_routes
end
end

0 comments on commit d95f9e0

Please sign in to comment.