website/lib/unix_dog.pm

49 lines
1.3 KiB
Perl
Raw Permalink Normal View History

2022-10-14 19:24:16 -05:00
package unix_dog;
2022-10-17 18:10:32 -05:00
use strict;
use warnings FATAL => 'all';
use experimental 'signatures';
2022-10-14 19:24:16 -05:00
use Mojo::Base 'Mojolicious', -signatures;
# This method will run once at server start
sub startup ($self) {
# Load configuration from config file
my $config = $self->plugin('NotYAMLConfig');
# Configure the application
$self->secrets($config->{secrets});
$self->defaults(title => 'UNIX.dog');
2023-01-03 23:01:50 -06:00
push @{$self->static->paths}, "/var/cache/stats/";
2022-10-14 19:24:16 -05:00
# Router
my $r = $self->routes;
# Normal route to controller
$r->get('/')->to('Main#index');
2022-10-15 01:29:55 -05:00
$r->get('/index.html')->to('Main#index');
2022-10-14 19:24:16 -05:00
$r->get('/rules')->to('Main#rules');
2024-01-06 17:43:54 -06:00
my $svc = $r->any('/services')->to(controller => 'Services');
$svc->get('/')->to(action => 'index');
$svc->get('/bridges')->to(action => 'bridges');
2022-10-15 01:12:39 -05:00
$r->get('/register')->to('Register#registration');
$r->post('/register')->to('Register#register');
2022-10-15 15:45:04 -05:00
$r->get('/account')->to('Account#account');
$r->post('/account')->to('Account#update_account');
2022-10-15 21:10:55 -05:00
$r->get('/users')->to('Main#user_pages');
2022-11-03 12:42:42 -05:00
$r->get('/announcements')->to('Main#announcements');
$r->get('/announcements.rss')->to('Main#announcement_feed');
$r->get('/announcement/#filename')->to('Main#get_announcement');
2023-01-03 23:40:17 -06:00
$r->get('/stats')->to('Main#get_stats');
2022-10-14 19:24:16 -05:00
}
1;