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
Note that once you use the middleware plugin, you can only use the Roda app as middleware, and you will get errors if you attempt to use it as a regular app.
Defined Under Namespace
Modules: ClassMethods Classes: Forwarder