NAME
Dancer2::Controllers
SYNOPSIS
Dancer2::Controllers is a Spring-Boot esq wrapper for defining Dancer2 routes, it allows you to define routes inside of modules using method attributes.
EXAMPLE
package MyApp::Controller;
use Moose;
BEGIN { extends 'Dancer2::Controllers::Controller' }
sub hello_world : Route(get => /) {
"Hello World!";
}
1;
package main;
use Dancer2;
use Dancer2::Controllers;
controllers( ['MyApp::Controller'] );
dance;
API
controllers
controllers( [
'MyApp::Controller::Foo',
'MyApp::Controller::Bar'
] );
A subroutine that takes a list of controller module names, and registers their routes methods, annotated by the Route
attribute.