Skip to content

Instantly share code, notes, and snippets.

@adamluzsi
Created June 26, 2016 16:12
Show Gist options
  • Save adamluzsi/60e9bfa2e424c40b37432fe8ab174a5e to your computer and use it in GitHub Desktop.
Save adamluzsi/60e9bfa2e424c40b37432fe8ab174a5e to your computer and use it in GitHub Desktop.
rack-app mounting/resources
require "rack/app"
class App < Rack::App
require_relative 'app_child'
require_relative 'app_not_child'
mount App::Child, to: '/child'
namespace '/affects_mounting_too' do
mount App::NotChild, to: '/not_child'
end
get '/' do
'some root endpoint'
end
end
class App::Child < App
namespace '/some' do
desc 'sample endpoint in subapp1'
get '/endpoint' do
'Hello, World!'
end
end
end
class App::NotChild < Rack::App
get do
end
post do
end
put do
end
delete do
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment