diff options
Diffstat (limited to 'template')
-rw-r--r-- | template/perl/base-psgi-hello.pl | 7 | ||||
-rw-r--r-- | template/perl/base-psgi-static.pl | 24 |
2 files changed, 31 insertions, 0 deletions
diff --git a/template/perl/base-psgi-hello.pl b/template/perl/base-psgi-hello.pl new file mode 100644 index 0000000..59576e8 --- /dev/null +++ b/template/perl/base-psgi-hello.pl @@ -0,0 +1,7 @@ +my $handler = sub { + return [ + 200, + [ "Content-Type" => "text/plain", "Content-Length" => 11 ], + [ "Hello World" ], + ]; +}; diff --git a/template/perl/base-psgi-static.pl b/template/perl/base-psgi-static.pl new file mode 100644 index 0000000..aebf116 --- /dev/null +++ b/template/perl/base-psgi-static.pl @@ -0,0 +1,24 @@ +use strict; +use warnings; +use Plack::Builder; +use Plack::Request; + +my $app = sub { + my $env = shift; + my $req = Plack::Request->new($env); + return root($req) if $req->path eq '/'; + [ 404, [ "Content-Type" => "text/plain" ], ["Not Found"] ]; +}; + +sub root { + my $req = shift; + my $res = $req->new_response(200); + $res->content_type('text/html'); + $res->body('hello world'); + $res->finalize(); +} + +builder { + enable "Plack::Middleware::Static", path => qr/static/, root => '.'; + $app; +}; |