Skip to content

Commit

Permalink
Move api to its own controller
Browse files Browse the repository at this point in the history
  • Loading branch information
hellcp committed Feb 13, 2020
1 parent 2200618 commit 42ba0ea
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
7 changes: 7 additions & 0 deletions app/controllers/api_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# frozen_string_literal: true

class ApiController < OBSController
def distributions
@leap_versions = load_releases
end
end
4 changes: 0 additions & 4 deletions app/controllers/distributions_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@ def index
render layout: 'download'
end

def api
@leap_versions = load_releases
end

# A single action for all supported Leap releases.
# GET /distributions/leap/(:version)
def leap
Expand Down
File renamed without changes.
3 changes: 2 additions & 1 deletion config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@
get 'leap/ports', to: 'distributions#leap_ports'
get 'testing', to: 'distributions#leap', version: 'testing'
get 'legacy', to: 'distributions#leap', version: 'legacy'
get 'api', to: 'distributions#api', :defaults => { :format => 'json' }
end
end

get 'api/v0/distributions', to: 'api#distributions', :defaults => { :format => 'json' }

resources :search, only: [:index] do
end
get 'find', to: 'search#find', :format => false
Expand Down

0 comments on commit 42ba0ea

Please sign in to comment.