Hi Julien,
AFAIK, if you add the others apps to the middleware stack on the rack's
land, they will be visible to rack but not to your main app.
What you can do is add the others apps as middleware inside the main
app, here is an example:
class MyAppA < Sinatra::Base
get '/a' do
'<h1>Hello A</h1>'
end
end
class MyAppB < Sinatra::Base
get '/b' do
'<h1>Hello B</h1>'
end
end
class MainApp < Sinatra::Base
use MyAppA
use MyAppB
get '/' do
settings.middleware # => [[MyAppA, [], nil], [MyAppB, [], nil]]
'<h1>Hello</h1>'
end
end
Hope this can help you :)
Hi ML readers,
I would
like to build a very simple application server using Sinatra.
To
do so, the idea is to use the Rack config file to "register"
applications.
Example:
use MyApp1
use MyApp2
...
run
Middleware
However I am facing a weird problem: how can I
retrieve the list of application from the top-level middleware (i.e.
Middleware class/instance).
I need that to create links to
applications from the main page of the application server website. I
wondered to something like
middleware.get_apps which returns the
list of application as a Hash.
Thanks for helping...
Julien.
--
You received this message because you are subscribed to the Google
Groups "sinatrarb" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to
sinatrarb+...@googlegroups.com.
For more options, visit
https://groups.google.com/groups/opt_out.