about summary refs log tree commit diff
path: root/config
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2016-09-27 16:58:23 +0200
committerEugen Rochko <eugen@zeonfederated.com>2016-09-27 16:59:08 +0200
commit4f9b7432dd4d323ac6cc4efceeae2efaffe62e7d (patch)
treeacae9e59bd6971885f7cb7b7ed45c4c9d1af4fca /config
parent3f75f522856954690d92358107e78bafd0db0baa (diff)
Fix #52 - Add API versioning (v1)
Diffstat (limited to 'config')
-rw-r--r--config/routes.rb62
1 files changed, 32 insertions, 30 deletions
diff --git a/config/routes.rb b/config/routes.rb
index 737dbbecf..f95ac2ab7 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -39,38 +39,40 @@ Rails.application.routes.draw do
     post '/salmon/:id', to: 'salmon#update', as: :salmon
 
     # JSON / REST API
-    resources :statuses, only: [:create, :show, :destroy] do
-      collection do
-        get :home
-        get :mentions
+    namespace :v1 do
+      resources :statuses, only: [:create, :show, :destroy] do
+        collection do
+          get :home
+          get :mentions
+        end
+
+        member do
+          get :context
+
+          post :reblog
+          post :unreblog
+          post :favourite
+          post :unfavourite
+        end
       end
 
-      member do
-        get :context
-
-        post :reblog
-        post :unreblog
-        post :favourite
-        post :unfavourite
-      end
-    end
-
-    resources :follows,  only: [:create]
-    resources :media,    only: [:create]
-    resources :apps,     only: [:create]
-    
-    resources :accounts, only: [:show] do
-      collection do
-        get :relationships
-      end
-
-      member do
-        get :statuses
-        get :followers
-        get :following
-
-        post :follow
-        post :unfollow
+      resources :follows,  only: [:create]
+      resources :media,    only: [:create]
+      resources :apps,     only: [:create]
+      
+      resources :accounts, only: [:show] do
+        collection do
+          get :relationships
+        end
+
+        member do
+          get :statuses
+          get :followers
+          get :following
+
+          post :follow
+          post :unfollow
+        end
       end
     end
   end