X-Git-Url: http://git.ieval.ro/?p=nethack-naodash.git;a=blobdiff_plain;f=app.psgi;fp=app.psgi;h=984b37f0369e6f960b0b8daed1de2d9add8fe111;hp=a71a3cffa76d6380df318844df6e3250be887a97;hb=42f966d60ef1754a7363522d04bff5d0f7919113;hpb=49bfce9d5386b4c3b36b93b72475b0766dd83307 diff --git a/app.psgi b/app.psgi index a71a3cf..984b37f 100644 --- a/app.psgi +++ b/app.psgi @@ -3,11 +3,20 @@ use 5.014000; use warnings; use App::Web::NAOdash; +use File::Slurp; use Plack::Builder; +my $index = read_file 'web/index.html'; + builder { mount '/dash/' => App::Web::NAOdash->new->to_app; mount '/json/' => App::Web::NAOdash->new(json => 1)->to_app; mount '/ok' => sub { [200, [], []] }; - mount '/' => sub { App::Web::NAOdash::reply(404, 'Try /dash/USERNAME or /json/USERNAME')}; + mount '/' => sub { + [200, [ + 'Cache-Control' => 'max-age=86400', + 'Content-Type' => "text/html; charset=utf-8", + 'Content-Length' => length $index, + ], [$index]] + }; }