msgba-web/lib/MSGBA/Web.pm

26 lines
566 B
Perl

package MSGBA::Web;
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' => { file => './msgba-web.yml' });
# Configure the application
$self->secrets($config->{secrets});
# Router
my $r = $self->routes;
# Normal route to controller
#$r->get('/')->to('Static#index');
$r->websocket('/ws')->to('WS#proxy');
$r->get('/', => sub {
my $c = shift;
$c->reply->static('index.html');
});
}
1;