Add an About page.

This commit is contained in:
barnold 2022-09-15 08:52:05 +01:00
parent a3c8a8ae8e
commit bce8bbeb1c
4 changed files with 10 additions and 2 deletions

View File

@ -7,6 +7,7 @@ sub startup ($self) {
# route's default name seems to come from '/path' with the leading # route's default name seems to come from '/path' with the leading
# '/' removed. # '/' removed.
$r->get('/')->to('home#index')->name('home'); $r->get('/')->to('home#index')->name('home');
$r->get('/about')->to('home#about');
$r->get('/auth')->to('auth#index'); $r->get('/auth')->to('auth#index');
$r->post('/login')->to('auth#login'); $r->post('/login')->to('auth#login');
$r->get('/logout')->to('auth#logout'); $r->get('/logout')->to('auth#logout');

View File

@ -1,7 +1,8 @@
package MyApp::Controller::Home; package MyApp::Controller::Home;
use Mojo::Base 'Mojolicious::Controller', -signatures; use Mojo::Base 'Mojolicious::Controller', -signatures;
sub index ($self) { # No need for a method for either 'index' or 'about'.
} # sub index ($self) {
# }
1; 1;

View File

@ -0,0 +1,5 @@
% layout 'default';
% title 'About';
<h1>About</h1>
All about MyApp.

View File

@ -4,6 +4,7 @@
<p>Other pages:</p> <p>Other pages:</p>
<p><%= link_to("About" => 'about') %>
<p><%= link_to("Books" => 'book') %> <p><%= link_to("Books" => 'book') %>
<p><%= link_to("Foo" => 'foo') %> <p><%= link_to("Foo" => 'foo') %>
<p><%= link_to("temp1" => 'temp1') %> <p><%= link_to("temp1" => 'temp1') %>