routes.rb 3.74 KB
Newer Older
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
1
require 'sidekiq/web'
2
require 'sidekiq/cron/web'
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
3

Valery Sizov's avatar
Valery Sizov committed
4
Rails.application.routes.draw do
5 6
  concern :access_requestable do
    post :request_access, on: :collection
7
    post :approve_access_request, on: :member
8 9
  end

10 11 12 13
  concern :awardable do
    post :toggle_award_emoji, on: :member
  end

14 15 16 17 18 19
  favicon_redirect = redirect do |_params, _request|
    ActionController::Base.helpers.asset_url(Gitlab::Favicon.main)
  end
  get 'favicon.png', to: favicon_redirect
  get 'favicon.ico', to: favicon_redirect

20 21 22
  draw :sherlock
  draw :development
  draw :ci
23

Valery Sizov's avatar
Valery Sizov committed
24
  use_doorkeeper do
25 26 27
    controllers applications: 'oauth/applications',
                authorized_applications: 'oauth/authorized_applications',
                authorizations: 'oauth/authorizations'
Valery Sizov's avatar
Valery Sizov committed
28
  end
29

30 31 32 33
  # This is here so we can "reserve" the path for the Jira integration in GitLab EE
  # Having a non-existent controller here does not affect the scope in any way since all possible routes
  # get a 404 proc returned. It is written in this way to minimize merge conflicts with EE
  scope path: '/login/oauth', controller: 'oauth/jira/authorizations', as: :oauth_jira do
34
    match '*all', via: [:get, :post], to: proc { [404, {}, ['']] }
35 36
  end

37 38
  draw :oauth

39 40
  use_doorkeeper_openid_connect

41 42 43
  # Autocomplete
  get '/autocomplete/users' => 'autocomplete#users'
  get '/autocomplete/users/:id' => 'autocomplete#user'
44
  get '/autocomplete/projects' => 'autocomplete#projects'
Hiroyuki Sato's avatar
Hiroyuki Sato committed
45
  get '/autocomplete/award_emojis' => 'autocomplete#award_emojis'
46

47
  # Search
48 49
  get 'search' => 'search#show'
  get 'search/autocomplete' => 'search#autocomplete', as: :search_autocomplete
Valery Sizov's avatar
Valery Sizov committed
50

Kamil Trzcinski's avatar
Kamil Trzcinski committed
51 52 53
  # JSON Web Token
  get 'jwt/auth' => 'jwt#auth'

54
  # Health check
55
  get 'health_check(/:checks)' => 'health_check#index', as: :health_check
56

57
  scope path: '-' do
58
    # '/-/health' implemented by BasicHealthMiddleware
59 60
    get 'liveness' => 'health#liveness'
    get 'readiness' => 'health#readiness'
61
    resources :metrics, only: [:index]
62
    mount Peek::Railtie => '/peek', as: 'peek_routes'
63 64 65 66 67 68 69 70 71 72 73 74 75

    # Boards resources shared between group and projects
    resources :boards, only: [] do
      resources :lists, module: :boards, only: [:index, :create, :update, :destroy] do
        collection do
          post :generate
        end

        resources :issues, only: [:index, :create, :update]
      end

      resources :issues, module: :boards, only: [:index, :update]
    end
76

77 78 79 80 81 82 83 84 85 86 87 88 89 90 91
    resources :clusters, only: [:update, :destroy] do
      collection do
        post :create_user
        post :create_gcp
      end

      member do
        scope :applications do
          post '/:application', to: 'clusters/applications#create', as: :install_applications
        end

        get :status, format: :json
      end
    end

92 93
    # UserCallouts
    resources :user_callouts, only: [:create]
Phil Hughes's avatar
Phil Hughes committed
94 95 96

    get 'ide' => 'ide#index'
    get 'ide/*vueroute' => 'ide#index', format: false
97

98
    draw :operations
99
    draw :instance_statistics
100 101
  end

102
  concern :clusterable do
103
    resources :clusters, only: [:index, :new, :show], controller: '/clusters'
104 105
  end

106 107 108 109
  draw :api
  draw :sidekiq
  draw :help
  draw :snippets
Andrew8xx8's avatar
Andrew8xx8 committed
110

Douwe Maan's avatar
Douwe Maan committed
111 112 113 114
  # Invites
  resources :invites, only: [:show], constraints: { id: /[A-Za-z0-9_-]+/ } do
    member do
      post :accept
Douwe Maan's avatar
Douwe Maan committed
115
      match :decline, via: [:get, :post]
Douwe Maan's avatar
Douwe Maan committed
116 117
    end
  end
118

119
  resources :sent_notifications, only: [], constraints: { id: /\h{32}/ } do
120 121 122 123 124
    member do
      get :unsubscribe
    end
  end

125 126 127
  # Spam reports
  resources :abuse_reports, only: [:new, :create]

128 129 130
  # Notification settings
  resources :notification_settings, only: [:create, :update]

131
  draw :google_api
132 133 134 135 136 137 138 139 140
  draw :import
  draw :uploads
  draw :explore
  draw :admin
  draw :profile
  draw :dashboard
  draw :group
  draw :user
  draw :project
gitlabhq's avatar
gitlabhq committed
141

142
  root to: "root#index"
143

144
  get '*unmatched_route', to: 'application#route_not_found'
gitlabhq's avatar
gitlabhq committed
145
end