3781: Set CORS headers in API responses.
[arvados.git] / services / api / config / routes.rb
1 Server::Application.routes.draw do
2   themes_for_rails
3
4   # See http://guides.rubyonrails.org/routing.html
5
6   # OPTIONS requests just get an empty response with CORS headers.
7   match '*a', :to => 'static#empty', :via => 'OPTIONS'
8
9   namespace :arvados do
10     namespace :v1 do
11       resources :api_client_authorizations do
12         post 'create_system_auth', on: :collection
13       end
14       resources :api_clients
15       resources :authorized_keys
16       resources :collections do
17         get 'provenance', on: :member
18         get 'used_by', on: :member
19       end
20       resources :groups do
21         get 'contents', on: :collection
22         get 'contents', on: :member
23       end
24       resources :humans
25       resources :job_tasks
26       resources :jobs do
27         get 'queue', on: :collection
28         get 'queue_size', on: :collection
29         post 'cancel', on: :member
30         post 'lock', on: :member
31       end
32       resources :keep_disks do
33         post 'ping', on: :collection
34       end
35       resources :keep_services do
36         get 'accessible', on: :collection
37       end
38       resources :links
39       resources :logs
40       resources :nodes do
41         post 'ping', on: :member
42       end
43       resources :pipeline_instances
44       resources :pipeline_templates
45       resources :repositories do
46         get 'get_all_permissions', on: :collection
47       end
48       resources :specimens
49       resources :traits
50       resources :user_agreements do
51         get 'signatures', on: :collection
52         post 'sign', on: :collection
53       end
54       resources :users do
55         get 'current', on: :collection
56         get 'system', on: :collection
57         post 'activate', on: :member
58         post 'setup', on: :collection
59         post 'unsetup', on: :member
60       end
61       resources :virtual_machines do
62         get 'logins', on: :member
63         get 'get_all_logins', on: :collection
64       end
65       get '/permissions/:uuid', :to => 'links#get_permissions'
66     end
67   end
68
69   # omniauth
70   match '/auth/:provider/callback', :to => 'user_sessions#create'
71   match '/auth/failure', :to => 'user_sessions#failure'
72
73   # Custom logout
74   match '/login', :to => 'user_sessions#login'
75   match '/logout', :to => 'user_sessions#logout'
76
77   match '/discovery/v1/apis/arvados/v1/rest', :to => 'arvados/v1/schema#index'
78
79   match '/static/login_failure', :to => 'static#login_failure', :as => :login_failure
80
81   # Send unroutable requests to an arbitrary controller
82   # (ends up at ApplicationController#render_not_found)
83   match '*a', :to => 'static#render_not_found'
84
85   root :to => 'static#home'
86 end