From 4f9b7432dd4d323ac6cc4efceeae2efaffe62e7d Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Tue, 27 Sep 2016 16:58:23 +0200 Subject: Fix #52 - Add API versioning (v1) --- config/routes.rb | 62 +++++++++++++++++++++++++++++--------------------------- 1 file changed, 32 insertions(+), 30 deletions(-) (limited to 'config/routes.rb') 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 -- cgit