Set up Grape API v3

pull/1435/head
Marek Takac 11 years ago
parent b270fa6164
commit d19a5d698a
  1. 7
      app/api/api.rb
  2. 4
      config/application.rb
  3. 2
      config/routes.rb

@ -0,0 +1,7 @@
class API < Grape::API
format :json
get '/' do
"I work!"
end
end

@ -138,6 +138,10 @@ module OpenProject
ActionMailer::Base.view_paths = ActionView::PathSet.new(ActionMailer::Base.view_paths.to_ary.reverse) ActionMailer::Base.view_paths = ActionView::PathSet.new(ActionMailer::Base.view_paths.to_ary.reverse)
end end
# Load API files
config.paths.add File.join('app', 'api'), glob: File.join('**', '*.rb')
config.autoload_paths += Dir[Rails.root.join('app', 'api', '*')]
OpenProject::Configuration.configure_cache(config) OpenProject::Configuration.configure_cache(config)
end end
end end

@ -117,6 +117,8 @@ OpenProject::Application.routes.draw do
end end
end end
mount API => '/api/v3'
match '/roles/workflow/:id/:role_id/:type_id' => 'roles#workflow' match '/roles/workflow/:id/:role_id/:type_id' => 'roles#workflow'
match '/help/:ctrl/:page' => 'help#index' match '/help/:ctrl/:page' => 'help#index'

Loading…
Cancel
Save