jam-cloud/config/routes.rb

54 lines
2.1 KiB
Ruby

SampleApp::Application.routes.draw do
scope :as => 'jam_ruby' do
resources :users
resources :music_sessions
end
resources :users
resources :music_sessions
resources :friend_requests
resources :sessions, only: [:new, :create, :destroy]
root to: 'static_pages#home'
match '/signup', to: 'users#new'
match '/signin', to: 'sessions#new'
match '/signout', to: 'sessions#destroy', via: :delete
match '/help', to: 'static_pages#help'
match '/about', to: 'static_pages#about'
match '/contact', to: 'static_pages#contact'
match '/client', to: 'clients#index'
scope '/api' do
# music sessions
match '/sessions/:id/participants' => 'api_music_sessions#participant_create', :via => :post
match '/participants/:id' => 'api_music_sessions#participant_show', :via => :get, :as => 'api_session_participant_detail'
match '/participants/:id' => 'api_music_sessions#participant_delete', :via => :delete
match '/sessions/:id' => 'api_music_sessions#show', :via => :get, :as => 'api_session_detail'
match '/sessions/:id' => 'api_music_sessions#delete', :via => :delete
match '/sessions' => 'api_music_sessions#index', :via => :get
match '/sessions' => 'api_music_sessions#create', :via => :post
# users
match '/users' => 'api_users#index', :via => :get
match '/users/:id' => 'api_users#show', :via => :get, :as => 'api_user_detail'
match '/users' => 'api_users#create', :via => :post
match '/users/:id' => 'api_users#update', :via => :put
match '/users/:id' => 'api_users#destroy', :via => :delete
# friend requests
match '/users/:id/friend_requests' => 'api_users#friend_request_index', :via => :get
match '/friend_requests/:id' => 'api_users#friend_request_show', :via => :get, :as => 'api_friend_request_detail'
match '/friend_requests' => 'api_users#friend_request_create', :via => :post
match '/friend_requests/:id' => 'api_users#friend_request_update', :via => :put
# friends
match '/users/:id/friends' => 'api_users#friend_index', :via => :get
match '/users/:id/friends/:friend_id' => 'api_users#friend_destroy', :via => :delete
end
end