Skip to content

Instantly share code, notes, and snippets.

@clkao
Created October 10, 2009 10:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save clkao/206770 to your computer and use it in GitHub Desktop.
Save clkao/206770 to your computer and use it in GitHub Desktop.
use strict;
use Plack::Builder;
use File::Basename qw(dirname);
use Cwd qw(abs_path);
my $handler = sub {
return [ 404, [ "Content-Type" => "text/plain" ], [ "Not Found" ] ];
};
builder {
dispatch "/" => builder {
return [ 200, [ "Content-Type" => "text/plain", "Content-Length" => 11 ], [ "Hello World" ] ];
};
dispatch "/static" => builder {
add "Plack::Middleware::Static",
path => qr/./, root => dirname(__FILE__);
$handler;
};
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment