about summary refs log tree commit homepage
path: root/examples
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2015-12-12 04:15:48 +0000
committerEric Wong <e@80x24.org>2016-04-05 18:58:27 +0000
commitb30bc98b0296dae835bbdfce727239fd644972e2 (patch)
treeb3ab46bb6ff28f3c49115a00898072c5e1b0124d /examples
parent487bb3b2e43db8e8ebc0340039f7f22b79d45b25 (diff)
downloadpublic-inbox-b30bc98b0296dae835bbdfce727239fd644972e2.tar.gz
Basically stealing URLs and parameters from cgit as much
as we can.  This could get get interesting...
Diffstat (limited to 'examples')
-rw-r--r--examples/repo-browse.psgi25
1 files changed, 25 insertions, 0 deletions
diff --git a/examples/repo-browse.psgi b/examples/repo-browse.psgi
new file mode 100644
index 00000000..b02b8e8b
--- /dev/null
+++ b/examples/repo-browse.psgi
@@ -0,0 +1,25 @@
+#!/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 {
+        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);
+        }
+}