NAME
HTTP::Engine::Interface::PSGI - PSGI interface for HTTP::Engine
SYNOPSIS
use HTTP::Engine;
use Plack::Loader;
my $engine = HTTP::Engine->new(
interface => {
module => 'PSGI',
request_handler => sub {
HTTP::Engine::Response->new( body => 'ok' );
},
},
);
my $app = sub { $engine->run(@_) };
Plack::Loader->load('Standalone', port => 801)->run($app); # see L<Plack::Server::Standalone> and L<Plack::Loader>
if you want streaming response
use HTTP::Engine;
use IO::Handle::Util qw(io_from_getline); # see L<IO::Handle::Util>
use Plack::Loader;
my $count = 1;
my $engine = HTTP::Engine->new(
interface => {
module => 'PSGI',
request_handler => sub {
HTTP::Engine::Response->new( body => io_from_getline { return "count: " . $count++ } );
},
},
);
my $app = sub { $engine->run(@_) };
Plack::Loader->load('AnyEvent', port => 801)->run($app); # see L<Plack::Server::AnyEvent>
AUTHOR
yappo
SEE ALSO
LICENSE
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.