website/lib/unix_dog.pm
2024-01-06 15:43:54 -08:00

48 lines
1.3 KiB
Perl

package unix_dog;
use strict;
use warnings FATAL => 'all';
use experimental 'signatures';
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');
push @{$self->static->paths}, "/var/cache/stats/";
# Router
my $r = $self->routes;
# Normal route to controller
$r->get('/')->to('Main#index');
$r->get('/index.html')->to('Main#index');
$r->get('/rules')->to('Main#rules');
my $svc = $r->any('/services')->to(controller => 'Services');
$svc->get('/')->to(action => 'index');
$svc->get('/bridges')->to(action => 'bridges');
$r->get('/register')->to('Register#registration');
$r->post('/register')->to('Register#register');
$r->get('/account')->to('Account#account');
$r->post('/account')->to('Account#update_account');
$r->get('/users')->to('Main#user_pages');
$r->get('/announcements')->to('Main#announcements');
$r->get('/announcements.rss')->to('Main#announcement_feed');
$r->get('/announcement/#filename')->to('Main#get_announcement');
$r->get('/stats')->to('Main#get_stats');
}
1;