From: Eric Wong Date: Thu, 3 Sep 2015 08:19:48 +0000 (+0000) Subject: examples/public-inbox.psgi: update with middlewares X-Git-Tag: v1.0.0~926 X-Git-Url: http://www.git.stargrave.org/?p=public-inbox.git;a=commitdiff_plain;h=83fa9f483121526fceb0a40b715aaf6025b3e7fa examples/public-inbox.psgi: update with middlewares HTML, text, and probably Atom feeds should be compressed. --- diff --git a/examples/public-inbox.psgi b/examples/public-inbox.psgi index 8eb67eb1..04f3329a 100644 --- a/examples/public-inbox.psgi +++ b/examples/public-inbox.psgi @@ -5,9 +5,17 @@ # Usage: plackup [OPTIONS] /path/to/this/file use strict; use warnings; -require PublicInbox::WWW; -require Plack::Request; -sub { - my $req = Plack::Request->new(@_); - PublicInbox::WWW::run($req, $req->method); -}; +use PublicInbox::WWW; +PublicInbox::WWW->preload; +use Plack::Request; +use Plack::Builder; +builder { + enable "Deflater", + content_type => [ 'text/html', 'text/plain', + 'application/atom+xml' ]; + enable "Head"; + sub { + my $req = Plack::Request->new(@_); + PublicInbox::WWW::run($req, $req->method); + } +}