NAME
PAGI::App::NotFound - Customizable 404 response
SYNOPSIS
# A fixed 404 is just a response value (preferred):
use PAGI::Response;
$router->mount('/missing' => PAGI::Response->text('Not Found')->status(404));
# PAGI::App::NotFound is for a computed body or custom defaults
# (e.g. a Cascade fallback):
use PAGI::App::NotFound;
my $app = PAGI::App::NotFound->new(
status => 404,
content_type => 'text/html',
body => sub { my ($scope) = @_; render_404($scope) },
)->to_app;
DESCRIPTION
For a fixed body, prefer a PAGI::Response value directly (e.g. PAGI::Response->text('Not Found', status => 404)). Use this module when you need a per-request (coderef) body or non-default content type or status code as a Cascade fallback.
Returns a customizable 404 (or other status) response. Useful as a fallback in a Cascade.
OPTIONS
body- Response body (string or coderef, default: 'Not Found')content_type- Content-Type header (default: 'text/plain')status- HTTP status code (default: 404)