|
|
|
@ -11,17 +11,27 @@ sub startup {
|
|
|
|
|
$self->plugin('CMTD::Helpers'); |
|
|
|
|
$self->plugin(Config => {file => 'cmtd.conf'}); |
|
|
|
|
|
|
|
|
|
$self->app->attr(captcha => sub { |
|
|
|
|
my $config = $self->app->config->{captcha}; |
|
|
|
|
require CMTD::Captcha; |
|
|
|
|
my $cap = CMTD::Captcha->new(%{ $config }); |
|
|
|
|
return $cap; |
|
|
|
|
}); |
|
|
|
|
$self->app->attr(db => sub { |
|
|
|
|
my $config = $self->app->config->{db} || []; |
|
|
|
|
require DBIx::Simple; |
|
|
|
|
my $dbh = DBIx::Simple->new(@{ $config }); |
|
|
|
|
return $dbh; |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
my $r = $self->routes; |
|
|
|
|
|
|
|
|
|
$r->get('/') |
|
|
|
|
-> to('main#index'); |
|
|
|
|
|
|
|
|
|
$r->get('/captcha') |
|
|
|
|
-> to('main#captcha'); |
|
|
|
|
|
|
|
|
|
$r->get('/comments/list') |
|
|
|
|
-> to('main#c_list'); |
|
|
|
|
|
|
|
|
|
$r->get('/comments/add') |
|
|
|
|
-> to('main#c_add'); |
|
|
|
|
} |
|
|
|
|