routes.rb 3.69 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

Valeriy's avatar
Valeriy 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

Valeriy's avatar
Valeriy committed
24
  use_doorkeeper do
25 26 27
    controllers applications: 'oauth/applications',
                authorized_applications: 'oauth/authorized_applications',
                authorizations: 'oauth/authorizations'
Valeriy's avatar
Valeriy 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'
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
Valeriy's avatar
Valeriy committed
50

Kamil Trzciński's avatar
Kamil Trzciński 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
    # UserCallouts
    resources :user_callouts, only: [:create]

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

    draw :operations
    draw :instance_statistics
  end

  concern :clusterable do
    resources :clusters, only: [:index, :new, :show, :update, :destroy] do
89 90 91 92 93 94 95 96 97 98
      collection do
        post :create_user
        post :create_gcp
      end

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

99
        get :cluster_status, format: :json
100 101
      end
    end
102 103
  end

104 105 106 107
  draw :api
  draw :sidekiq
  draw :help
  draw :snippets
108

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

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

123 124 125
  # Spam reports
  resources :abuse_reports, only: [:new, :create]

126 127 128
  # Notification settings
  resources :notification_settings, only: [:create, :update]

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

140
  root to: "root#index"
141

142
  get '*unmatched_route', to: 'application#route_not_found'
gitlabhq's avatar
gitlabhq committed
143
end