about summary refs log tree commit homepage
path: root/examples/repobrowse.psgi
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2015-12-23 10:03:30 +0000
committerEric Wong <e@80x24.org>2016-04-05 18:58:27 +0000
commit168c3d07ec6efa91d34d4e893dffa3431979a260 (patch)
treed87c624ea850e35ac29ba2c73b0382ed360fc3c4 /examples/repobrowse.psgi
parent1f803ace908120c8e048c3ae40f8e64651e8f6f1 (diff)
downloadpublic-inbox-168c3d07ec6efa91d34d4e893dffa3431979a260.tar.gz
We've been refering to this as "repobrowse", so drop the '-'.
While we're at it, enable chunking since we stream a good chunk
of our responses to avoid having too much in memory at once.
Diffstat (limited to 'examples/repobrowse.psgi')
-rw-r--r--examples/repobrowse.psgi26
1 files changed, 26 insertions, 0 deletions
diff --git a/examples/repobrowse.psgi b/examples/repobrowse.psgi
new file mode 100644
index 00000000..d7c096f8
--- /dev/null
+++ b/examples/repobrowse.psgi
@@ -0,0 +1,26 @@
+#!/usr/bin/perl -w
+# Copyright (C) 2015 all contributors <meta@public-inbox.org>
+# License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
+# Note: this is part of our test suite, update t/plack.t if this changes
+# Usage: plackup [OPTIONS] /path/to/this/file
+use strict;
+use warnings;
+use PublicInbox::RepoBrowse;
+use Plack::Request;
+use Plack::Builder;
+my $have_deflater = eval { require Plack::Middleware::Deflater; 1 };
+my $repo_browse = PublicInbox::RepoBrowse->new;
+
+builder {
+        enable 'Plack::Middleware::Chunked';
+        if ($have_deflater) {
+                enable 'Deflater',
+                        content_type => [ 'text/html', 'text/plain',
+                                          'application/atom+xml' ];
+        }
+        enable 'Head';
+        sub {
+                my $req = Plack::Request->new(@_);
+                $repo_browse->run($req, $req->method);
+        }
+}