Just a simple example using Plack::Builder and Plack::App::File to serve some static files using a Perl-based web server.
use strict;
use warnings;
use Plack::Builder;
use Plack::App::File;
my $app = Plack::App::File->new(root => "www")->to_app;
builder {
enable "DirIndex", dir_index => 'index.html';
$app;
}
Put this in a directory as app.psgi
. Put your HTML files in the 'www' subdirectory.
Run plackup
and you can visit http://127.0.0.1:5000/ to see the pages.
In this code we use the Plack::Middleware::DirIndex middleware that handles the files in the given directory.
Check out the other articles on Plack/PSGI.
Comments
There is handy oneliner as well: plackup -MPlack::App::Directory -e 'Plack::App::Directory->new(root => ".")->to_app'