The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Raisin::Routes - A routing class for Raisin.

SYNOPSIS

use Raisin::Routes;
my $r = Raisin::Routes->new;

my $params = { require => ['name', ], };
my $code = sub { { name => $params{name} } }

$r->add(
    method => 'GET',
    path   => '/user',
    params => $params,
    code   => $code
);
my $route = $r->find('GET', '/user');

DESCRIPTION

The router provides the connection between the HTTP requests and the web application code.

Adding routes
$r->add(method => 'GET', path => '/user', params => $params, code => $code);
Looking for a route
$r->find($method, $path);

PLACEHOLDERS

Regexp

qr#/user/(\d+)#

Required

/user/:id

Optional

/user/?id

METHODS

add

Adds a new route

find

Looking for a route

ACKNOWLEDGEMENTS

This module was inspired by Kelp::Routes.

AUTHOR

Artur Khabibullin - rtkh <at> cpan.org

LICENSE

This module and all the modules in this package are governed by the same license as Perl itself.