Hanami exposes a project level Rack middleware stack to be configured like this:
# config/environment.rb
Hanami.configure do
middleware.use MyRackMiddleware
end
It’s worth noticing that this is equivalent to add a middleware in config.ru
file. The only difference is that third-party plugins can hook into Hanami.configure
to inject their own middleware.