Skip to content

Commit

Permalink
users api を追加
Browse files Browse the repository at this point in the history
  • Loading branch information
Kazuya Tateishi committed Mar 25, 2015
1 parent 623dcc9 commit d2e4f75
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 0 deletions.
1 change: 1 addition & 0 deletions api-demo/app/apis/api/base.rb
@@ -1,4 +1,5 @@
module API
class Base < Grape::API
mount V1::Base
end
end
13 changes: 13 additions & 0 deletions api-demo/app/apis/api/v1/base.rb
@@ -0,0 +1,13 @@
module API
module V1
class Base < Grape::API
format :json
default_format :json

prefix 'api'
version 'v1', using: :path

mount V1::Users
end
end
end
11 changes: 11 additions & 0 deletions api-demo/app/apis/api/v1/users.rb
@@ -0,0 +1,11 @@
module API
module V1
class Users < Grape::API
resource :users do
get do
present User.all, with: Entity::V1::UsersEntity
end
end
end
end
end
7 changes: 7 additions & 0 deletions api-demo/app/apis/entity/v1/users_entity.rb
@@ -0,0 +1,7 @@
module Entity
module V1
class UsersEntity < Grape::Entity
expose :id, :name, :email
end
end
end

0 comments on commit d2e4f75

Please sign in to comment.