Added header for use during dev

This commit is contained in:
Tom Bloor 2017-04-04 22:21:57 +01:00
parent 3a08894641
commit b6064cc985

View file

@ -2,7 +2,6 @@ package Pear::LocalLoop;
use Mojo::Base 'Mojolicious'; use Mojo::Base 'Mojolicious';
use Data::UUID; use Data::UUID;
use Devel::Dwarn;
use Mojo::JSON; use Mojo::JSON;
use Data::Dumper; use Data::Dumper;
use Email::Valid; use Email::Valid;
@ -34,8 +33,6 @@ my $sessionTimeSeconds = 60 * 60 * 24 * 7; #1 week.
my $sessionTokenJsonName = 'sessionToken'; my $sessionTokenJsonName = 'sessionToken';
my $sessionExpiresJsonName = 'sessionExpires'; my $sessionExpiresJsonName = 'sessionExpires';
Dwarn $config;
# shortcut for use in template # shortcut for use in template
$self->helper( db => sub { $dbh }); $self->helper( db => sub { $dbh });
$self->helper( schema => sub { $schema }); $self->helper( schema => sub { $schema });
@ -71,6 +68,9 @@ $r->any( '/' => sub {
$self->hook( before_dispatch => sub { $self->hook( before_dispatch => sub {
my $self = shift; my $self = shift;
$self->app->log->debug('Before Dispatch');
$self->res->headers->header('Access-Control-Allow-Origin' => '*') if $self->app->mode eq 'development';
$self->remove_all_expired_sessions(); $self->remove_all_expired_sessions();
#See if logged in. #See if logged in.