From: Marius Gavrilescu Date: Sat, 22 Aug 2015 19:35:17 +0000 (+0300) Subject: Add a index page X-Git-Tag: 0.002~2 X-Git-Url: http://git.ieval.ro/?p=nethack-naodash.git;a=commitdiff_plain;h=42f966d60ef1754a7363522d04bff5d0f7919113 Add a index page --- diff --git a/MANIFEST b/MANIFEST index f7f2c14..25e0734 100644 --- a/MANIFEST +++ b/MANIFEST @@ -13,3 +13,4 @@ t/perlcritic.t t/xlogfile web/dash.css web/dash.html +web/index.html 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]] + }; } diff --git a/web/index.html b/web/index.html new file mode 100644 index 0000000..29e3019 --- /dev/null +++ b/web/index.html @@ -0,0 +1,48 @@ + + +NetHack.alt.org dashboards + + + +

NAOdash is a service that analyzes NetHack players' game data on the nethack.alt.org public server and displays statistics. + +

It can be used in several ways. In all cases below, USERNAME is your NAO username. + +

+
Website +
Go to /dash/USERNAME. Example. + +
CLI program +
Install the App::NAOdash module using your favourite CPAN client, for example by running cpanm --sudo App::NAOdash or sudo cpan App::NAOdash. +

You can then run naodash USERNAME. + +

JSON API +
Go to /json/USERNAME. Example. + +
Perl module +
Install the NetHack::NAOdash module using your favourite CPAN client. Link to documentation. +