Skip to content
Browse files

s/ServerSimple/Standalone/

  • Loading branch information...
1 parent 7c59db8 commit 06ab696696efe077ccb74ebf08b5f0dd96a11aa3 @dann committed Oct 14, 2009
Showing with 27 additions and 10 deletions.
  1. +1 −1 examples/example.pl
  2. +1 −7 examples/example.psgi
  3. +25 −2 lib/PlackX/Engine.pm
View
2 examples/example.pl
@@ -15,7 +15,7 @@
my $engine = PlackX::Engine->new(
{ server => {
- module => 'ServerSimple',
+ module => 'Standalone',
args => {
port => 3000,
host => 'localhost',
View
8 examples/example.psgi
@@ -11,13 +11,7 @@ my $request_handler = sub {
};
my $engine = PlackX::Engine->new(
- { server => {
- module => 'ServerSimple',
- args => {
- port => 3000,
- host => 'localhost',
- },
- },
+ {
request_handler => $request_handler,
middlewares => [
{ module => "Plack::Middleware::AccessLog::Timed" },
View
27 lib/PlackX/Engine.pm
@@ -123,17 +123,40 @@ PlackX::Engine - simple request wrapper for Plack
{ module => "Plack::Middleware::AccessLog::Timed" },
{ module => "Plack::Middleware::Static" }
],
- request_class => 'Plack::Request', # you can use request class
+ request_class => 'Plack::Request', # optional
}
);
$engine->run;
* case2: as psgi handler builder
- just create engine and return psgi_handler
+just create engine and return psgi_handler in example.psgi file
+ use PlackX::Engine;
+ use Plack::Response;
+
+ my $request_handler = sub {
+ my $req = shift;
+ my $res = Plack::Response->new;
+ $res->code(200);
+ $res->header( 'Content-Type' => 'text/html' );
+ $res->body( "Hello World" );
+ };
+
+ my $engine = PlackX::Engine->new(
+ {
+ request_handler => $request_handler,
+ middlewares => [
+ { module => "Plack::Middleware::AccessLog::Timed" },
+ { module => "Plack::Middleware::Static" }
+ ],
+ }
+ );
my $psgi_handler = $engine->psgi_handler;
+run your request handler with psgi
+
+ plackup -app example.psgi
=head1 DESCRIPTION

0 comments on commit 06ab696

Please sign in to comment.
Something went wrong with that request. Please try again.