NAME

PAGI::App::URLMap - Mount apps at URL path prefixes

SYNOPSIS

use PAGI::App::URLMap;

my $map = PAGI::App::URLMap->new;
$map->mount('/api' => $api_app);
$map->mount('/static' => $static_app);
my $app = $map->to_app;

DESCRIPTION

URLMap routes requests to different apps based on URL path prefix. Longest prefix match wins. The mounted app sees an adjusted path with the prefix removed.

OPTIONS

  • default - App to use when no prefix matches

METHODS

mount($prefix, $app)

Mount an app at the given path prefix.

map(\%mapping)

Mount multiple apps from a hashref of prefix => app pairs.