Skip to content
This repository
Newer
Older
100644 39 lines (32 sloc) 1.283 kb
30c5f573 » monken
2011-07-02 add app.psgi
1 package MetaCPAN::Web;
2
3 # ABSTRACT: Modern front-end for MetaCPAN
4 use strict;
5 use warnings;
6 use FindBin;
7 use lib "$FindBin::RealBin/lib";
8 use MetaCPAN::Web;
9 use Plack::App::File;
655e8630 » monken
2011-07-02 P::M::StackTrace fucks with Catalyst
10 use Plack::App::URLMap;
30c5f573 » monken
2011-07-02 add app.psgi
11 use Plack::Middleware::Assets;
12 use Plack::Middleware::Runtime;
13 use Plack::Middleware::ReverseProxy;
e0782891 » monken
2011-07-02 add Session::Cookie middleware
14 use Plack::Middleware::Session::Cookie;
30c5f573 » monken
2011-07-02 add app.psgi
15
16 my $api = 'http://' . ( $ENV{METACPAN_API} || 'api.metacpan.org' );
17
18 MetaCPAN::Web->setup_engine('PSGI');
19
20 my $app = Plack::App::URLMap->new;
21 $app->map( '/static/' => Plack::App::File->new( root => 'root/static' ) );
22 $app->map( '/favicon.ico' => Plack::App::File->new( file => 'root/static/icons/favicon.ico' ) );
23 $app->map( '/' => sub { MetaCPAN::Web->run(@_) } );
24 $app = Plack::Middleware::Runtime->wrap($app);
25 $app = Plack::Middleware::Assets->wrap( $app, files => [<root/static/css/*.css>] );
26 $app = Plack::Middleware::Assets->wrap(
27 $app,
28 files => [
29 map { "root/static/js/$_.js" }
30 qw(jquery.min jquery.tablesorter jquery.cookie jquery.relatize_date jquery.ajaxQueue jquery.autocomplete.pack shCore shBrushPerl cpan)
31 ],
32 minify => 0,
33 );
34
e0782891 » monken
2011-07-02 add Session::Cookie middleware
35 $app = Plack::Middleware::ReverseProxy->wrap($app);
36
37 Plack::Middleware::Session::Cookie->wrap($app, session_key => 'metacpan');
30c5f573 » monken
2011-07-02 add app.psgi
38
39 # ABSTRACT: A Front End for MetaCPAN
Something went wrong with that request. Please try again.