Add a simple Controller.

This commit is contained in:
barnold 2022-09-13 20:03:50 +01:00
parent 76334e7db8
commit bac3f3f480
2 changed files with 9 additions and 3 deletions

View File

@ -6,9 +6,7 @@ sub startup ($self) {
# This route gets an explicit name, else it's an empty string. A
# route's default name seems to come from '/path' with the leading
# '/' removed.
$r->get(
'/' => sub ($c) { $c->render(template => 'index'); }
)->name('/');
$r->get('/')->to('index#index')->name('/');
$r->get(
'/foo' => sub ($c) {
my $value = $c->param('param1');

View File

@ -0,0 +1,8 @@
package MyApp::Controller::Index;
use Mojo::Base 'Mojolicious::Controller', -signatures;
sub index ($self) {
$self->render(template => 'index');
}
1;