3

I am looking around on how to mount other rack apps such as a grape API to my padrino application. I tried searching around but couldn't possibly find an answer.

I tried with the following way:

Padrino.mount("API", :app_file => "path_to_api_rb", :app_class => "MyApp::API").to("/")

But Padrino didn't start with this setting. It seems that facility is only for Padrino-sub apps. Has anyone tried this before?

Manikandan
  • 417
  • 4
  • 8
  • 18
Lester Celestial
  • 1,454
  • 1
  • 16
  • 26

2 Answers2

2

here's a project showing how to use Grape as a subapp: PadrinoEatsGrape

(Other Rack apps could work, i guess)

iffan
  • 21
  • 2
  • Interesting, I'll try that out and see how that turns out. – Lester Celestial Jul 23 '12 at 13:45
  • I can't get this working. I've followed the file structure of this Gem but i'm getting errors, precisely: undefined method `error_format' for APIS::Vendors::Global::API_v1:Class in the console. The post is old, but if somebody have any idea is welcome. – halbano Oct 06 '14 at 19:27
0

u can use the Rack::Cascade: to mix the grape, rails and pandrino apps:

rails_app = Rack::Builder.new do
  use Rails::Rack::LogTailer #Optional
  use rails::Rack::Static    #Optional
  run ActionController::Dispatcher.new
end

run Rack::Cascade.new([
  MyApp::API,
  rails_app,
  Padrino.application
])
Riceball LEE
  • 1,541
  • 18
  • 18