Add a simple Controller.
This commit is contained in:
parent
76334e7db8
commit
bac3f3f480
|
@ -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');
|
||||
|
|
8
lib/MyApp/Controller/Index.pm
Normal file
8
lib/MyApp/Controller/Index.pm
Normal file
|
@ -0,0 +1,8 @@
|
|||
package MyApp::Controller::Index;
|
||||
use Mojo::Base 'Mojolicious::Controller', -signatures;
|
||||
|
||||
sub index ($self) {
|
||||
$self->render(template => 'index');
|
||||
}
|
||||
|
||||
1;
|
Loading…
Reference in New Issue
Block a user