Skip to content

Mounting another rack application

leucos edited this page Sep 24, 2012 · 2 revisions

You can use config.ru for this. For instance, let's say you want to serve static files with Rack::Static, you can set-up a config.ru like this :

require ::File.expand_path('../app', __FILE__)

use Rack::Static, :urls => ["/doc"], :root => "doc"

Ramaze.start(:root => Ramaze.options.roots, :started => true)
run Ramaze

This example is a bit specific, since it uses Rack::Static. A more general appoach involves using map. For instance, if you want to integrate sidekiq's web interface into your Ramaze application, you can do it like this :

require ::File.expand_path('../app', __FILE__)

require 'sidekiq'
require 'sidekiq/web'

map "/sidekiq" do
  use Rack::ShowExceptions
  run Sidekiq::Web
end

Ramaze.start(:root => Ramaze.options.roots, :started => true)
Clone this wiki locally