Skip to content

Commit

Permalink
Add a cascade app for serving up wwwdocs files
Browse files Browse the repository at this point in the history
Fixes GH book#22
  • Loading branch information
hoelzro authored and haarg committed Aug 20, 2018
1 parent fb17973 commit af5fe25
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions lib/Act/Dispatcher.pm
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use Encode qw(decode_utf8);
use Plack::Builder;
use Plack::Request;
use Plack::App::Cascade;
use Plack::App::File;

use Act::Config;
use Act::Handler::Static;
Expand Down Expand Up @@ -118,6 +119,21 @@ sub conference_app {
};
};
Plack::App::Cascade->new( catch => [99], apps => [
builder {
# XXX ugly, but functional for now
enable sub {
my ( $app ) = @_;
return sub {
my ( $env ) = @_;
my $res = $app->($env);
$res->[0] = 99 if $res->[0] == 404;
return $res;
};
};
Plack::App::File->new(root => $Config->general_root)->to_app;
},
builder {
enable '+Act::Middleware::Auth';
for my $uri ( keys %public_handlers ) {
Expand Down

0 comments on commit af5fe25

Please sign in to comment.