Created
October 10, 2009 10:34
-
-
Save clkao/206770 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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