NAME

Kelp::Middleware - Kelp app wrapper (PSGI middleware)

SYNOPSIS

middleware => [qw(TrailingSlashKiller Static)],
middleware_init => {
    TrailingSlashKiller => {
        redirect => 1,
    },
    Static => {
        path => qr{^/static},
        root => '.',
    },
}

DESCRIPTION

This is a small helper class which wraps Kelp in PSGI middleware. It is loaded and constructed by Kelp based on the value of "middleware_obj" in Kelp (class name).

This class only handles global middleware declared in configuration. Middleware localized to routes cannot be adjusted by customizing this class.

ATTRIBUTES

app

Main application object. Required.

METHODS

wrap

$wrapped_psgi = $object->wrap($psgi)

Wraps the object in all middlewares according to "app" configuration.