diff --git a/lib/BurguillosInfo.pm b/lib/BurguillosInfo.pm index ac22510..aab0027 100644 --- a/lib/BurguillosInfo.pm +++ b/lib/BurguillosInfo.pm @@ -6,27 +6,32 @@ use Mojo::Base 'Mojolicious', -signatures; # This method will run once at server start sub startup ($self) { - my $metrics = BurguillosInfo::Controller::Metrics->new; - $self->hook(around_dispatch => sub { - my $next = shift; - my $c = shift; - $metrics->request($c); - if (defined $next) { - $next->(); - } - }); - my $config = $self->plugin('JSONConfig'); - $self->config(hypnotoad => {listen => ['http://localhost:3000']}); - # Router - my $r = $self->routes; - - # Normal route to controller - $r->get('/')->to('Page#index'); -# $r->get('/:post')->to('Page#post'); - $r->get('/<:category>.rss')->to('Page#category_rss'); - $r->get('/:category')->to('Page#category'); - $r->get('/posts/<:slug>-preview.png')->to('Page#get_post_preview'); - $r->get('/posts/:slug')->to('Page#post'); + my $metrics = BurguillosInfo::Controller::Metrics->new; + $self->hook( + around_dispatch => sub { + my $next = shift; + my $c = shift; + $metrics->request($c); + if ( defined $next ) { + $next->(); + } + } + ); + my $config = $self->plugin('JSONConfig'); + $self->config( + hypnotoad => { proxy => 1, listen => ['http://localhost:3000'] } ); + + # Router + my $r = $self->routes; + + # Normal route to controller + $r->get('/')->to('Page#index'); + + # $r->get('/:post')->to('Page#post'); + $r->get('/<:category>.rss')->to('Page#category_rss'); + $r->get('/:category')->to('Page#category'); + $r->get('/posts/<:slug>-preview.png')->to('Page#get_post_preview'); + $r->get('/posts/:slug')->to('Page#post'); } 1;