Commit 3a345f77
Changed files (2)
app
controllers
api
config
app/controllers/api/v1/creations_controller.rb
@@ -0,0 +1,21 @@
+module Api
+ module V1
+ class CreationsController < ApplicationController
+ before_filter :restrict_access
+ respond_to :json
+
+ def index
+ respond_with Creation.all
+ end
+
+ private
+
+ def restrict_access
+ authenticate_or_request_with_http_token do |token, options|
+ User.exists?(:authentication_token => token)
+ end
+ end
+
+ end
+ end
+end
config/routes.rb
@@ -58,4 +58,9 @@ Cake::Application.routes.draw do
root :to => "creations#index"
+ namespace :api, :defaults => { :format => 'json' } do
+ namespace :v1 do
+ resources :creations
+ end
+ end
end