=encoding utf8 =head1 CUSTOMIZING Customizing you usage of Minima is quite straightforward once you understand how it works and a few PSGI concepts. If you haven't yet, check L<"How it works" in Minima|Minima/"HOW IT WORKS">. =head1 Setup The setup process can be completely skipped. If your goal is to create a custom app, load your configuration hash and create L yourself: F use Minima::App; my $app = Minima::App->new( environment => $env, configuration => $config, ); sub { $app->run } =head1 Controllers A controller is where you implement your application’s logic. Its main role is to return a valid PSGI response. By default, controllers inherit from L, which provides convenient lifecycle hooks and helper methods. However, inheritance is not required. A controller can simply provide the action methods declared in C. In that case, Minima will call the methods directly and expect them to return a valid PSGI response. This makes it easy to write very minimal controllers if you prefer. When L instantiates and calls your controller, it will pass two named arguments to C: app => $self, route => $m, Depending on your implementation details (whether your controller is a class, package, or another type of object) you may or may not use these arguments. =head2 Arguments =over 16 =item C A reference to the L instance which is initializing your controller. =item C The matched route as returned by L. =back =head2 Lifecycle Hooks Controllers may also define optional lifecycle hooks: =over 16 =item C Runs before the action is executed. If it returns a PSGI response, the action itself is skipped and that response is returned immediately. =item C Runs after the action has completed. It receives the response returned by the action, which can be modified in place if needed. =back For more details, see L. As your controller is called last, remember to return a valid PSGI response and you're good to go. =head1 Templating System If you want to customize how L