Add a index page
[nethack-naodash.git] / app.psgi
index a71a3cffa76d6380df318844df6e3250be887a97..984b37f0369e6f960b0b8daed1de2d9add8fe111 100644 (file)
--- 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]]
+       };
 }
This page took 0.009394 seconds and 4 git commands to generate.