]> Sergey Matveev's repositories - public-inbox.git/blob - examples/public-inbox.psgi
examples/public-inbox.psgi: shorten to simplify
[public-inbox.git] / examples / public-inbox.psgi
1 #!/usr/bin/perl -w
2 # Copyright (C) 2014-2015 all contributors <meta@public-inbox.org>
3 # License: AGPLv3 or later (https://www.gnu.org/licenses/agpl-3.0.txt)
4 # Note: this is part of our test suite, update t/plack.t if this changes
5 # Usage: plackup [OPTIONS] /path/to/this/file
6 use strict;
7 use warnings;
8 use PublicInbox::WWW;
9 PublicInbox::WWW->preload;
10 use Plack::Request;
11 use Plack::Builder;
12 my $have_deflater = eval { require Plack::Middleware::Deflater; 1 };
13
14 builder {
15         enable 'Chunked';
16         if ($have_deflater) {
17                 enable 'Deflater',
18                         content_type => [ 'text/html', 'text/plain',
19                                         'application/atom+xml' ];
20         }
21         enable 'Head';
22         sub {
23                 my $req = Plack::Request->new(@_);
24                 PublicInbox::WWW::run($req, $req->method);
25         }
26 }