Closed rawleyfowler closed 1 year ago
This would look something like:
use Humming-Bird::Core;
my $router = Router.new(root => '/foo');
# This will register a route at /foo/bar
$router.get('/bar', -> $request, $response { $response.write('Foo bar!') });
# This will register this middleware for all routes in this router
$router.middleware(&middleware-logger);
# This will register this advice for all routes in this router
$router.advice(&advice-logger);
I think it would be nice to be able to construct routers, this would be an OO style route declaration, that would provide the basis for more simpler grouping, and separation of concerns.