Created
June 26, 2016 16:12
-
-
Save adamluzsi/60e9bfa2e424c40b37432fe8ab174a5e to your computer and use it in GitHub Desktop.
rack-app mounting/resources
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class App::Child < App | |
namespace '/some' do | |
desc 'sample endpoint in subapp1' | |
get '/endpoint' do | |
'Hello, World!' | |
end | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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