-
-
Save anonymous/b2793006b202700ef83cee870d766237 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
package Site; | |
use Mojo::Base 'Mojolicious'; | |
use strict; | |
use warnings; | |
our $VERSION = "0.01"; | |
sub startup { | |
my $self = shift; | |
$self->sessions->cookie_name(__PACKAGE__); | |
$self->sessions->default_expiration(24 * 60 * 60 * 365); #1 year | |
my $r = $self->routes; | |
$r->namespaces(['Site::Controller']); | |
my $home = $r->any('/')->to(controller => 'Home'); | |
$home->get('/')->to(action => 'get'); | |
$self->log->path('mojo.log'); | |
$self->log->level('debug'); | |
} | |
1; | |
} | |
{ | |
package Site::Controller::Home; | |
use base qw|Mojolicious::Controller|; | |
sub get { | |
my $self = shift; | |
warn "UNDER GET"; | |
$self->app->log->warn('log is here'); | |
$self->render( text => 'LALALA' ); | |
} | |
1; | |
} | |
{ | |
use Test::More; | |
use Test::Mojo; | |
my $t = Test::Mojo->new('Site'); | |
$t->get_ok('/')->status_is(200); | |
done_testing; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment