NAME
Raisin::Routes - 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('GET', '/user', params => $params, $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('GET', '/user', params => $params, $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.