NAME
Thunderhorse::Module::Middleware - Middleware module for Thunderhorse
SYNOPSIS
# in application build method
$self->load_module('Middleware' => {
Static => {
path => '/static',
root => 'public',
},
Session => {
store => 'file',
},
});
# with explicit ordering
$self->load_module('Middleware' => {
Static => { path => '/static', root => 'public', _order => 1 },
Session => { store => 'file', _order => 2 },
});
DESCRIPTION
The Middleware module allows loading any PAGI middleware into the application. It wraps the entire PAGI application with specified middlewares.
CONFIGURATION
Each key in the configuration is a middleware class name (will be prefixed with PAGI::Middleware:: unless it starts with ^). The value is a hash reference of configuration passed to that middleware's constructor.
Middlewares are applied in deterministic order (sorted by key name). To control the order explicitly, use the _order key in middleware configuration.
Lower _order values are applied first, higher values are applied last.
ADDED INTERFACE
Application-level middleware
Application is wrapped in all middleware specified in the config.