Module: Roda::RodaPlugins::Middleware
- Defined in:
- lib/roda/plugins/middleware.rb
Overview
The middleware plugin allows the Roda app to be used as rack middleware.
In the example below, requests to /mid will return Mid by the Mid middleware, and requests to /app will not be matched by the Mid middleware, so they will be forwarded to App.
class Mid < Roda
plugin :middleware
route do |r|
r.is "mid" do
"Mid"
end
end
end
class App < Roda
use Mid
route do |r|
r.is "app" do
"App"
end
end
end
run App
It is possible to use the Roda app as a regular app even when using the middleware plugin.
Defined Under Namespace
Modules: ClassMethods, RequestMethods Classes: Forwarder