Module: Roda::RodaPlugins::MiddlewareStack

Defined in:
lib/roda/plugins/middleware_stack.rb

Overview

The middleware_stack plugin adds methods to remove middleware from the middleware stack, and insert new middleware at specific positions in the middleware stack.

plugin :middleware_stack

# Remove csrf middleware
middleware_stack.remove{|m, *args| m == Rack::Csrf}

# Insert csrf middleware
middleware_stack.before{|m, *args| m == Rack::CommonLogger}.use(Rack::Csrf, raise: true)
middleware_stack.after{|m, *args| m == Rack::CommonLogger}.use(Rack::Csrf, raise: true)

Defined Under Namespace

Modules: ClassMethods Classes: Stack, StackPosition