Project

General

Profile

« Previous | Next » 

Revision 3d6d01c7

Added by Ohad Levy almost 12 years ago

  • ID 3d6d01c70e5a48e92f7beb16e98096aeae14cb0c

fixes #1775 - API versioning name space

View differences:

config/routes.rb
require 'api_constraints'
Foreman::Application.routes.draw do
#ENC requests goes here
match "node/:name" => 'hosts#externalNodes', :constraints => { :name => /[^\.][\w\.-]+/ }
......
resources :tasks, :only => [:show]
#Keep this line the last route
#### API Namespace from here downwards ####
namespace :api, :defaults => {:format => 'json'} do
scope :module => :v1, :constraints => ApiConstraints.new(:version => 1, :default => true) do
resources :bookmarks, :except => [:new, :edit]
match '/', :to => 'home#index'
match 'status', :to => 'home#status', :as => "status"
end
# scope module: :v2, constraints: ApiConstraints.new(version: 2, default: true) do
# resources :bookmarks
# end
end
#Keep this line the last route
match '*a', :to => 'errors#routing'
end

Also available in: Unified diff