Skip to content

Commit fcdb5cf

Browse files
committed
simplify /v1/ dev rewrite
1 parent 3c7f972 commit fcdb5cf

File tree

4 files changed

+4
-19
lines changed

4 files changed

+4
-19
lines changed

app.psgi

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,9 @@ my $static
6161

6262
my $urlmap = Plack::App::URLMap->new;
6363
$urlmap->map( '/static' => $static );
64-
$urlmap->map( '/' => MetaCPAN::Server->app );
64+
if ( $ENV{PLACK_ENV} && $ENV{PLACK_ENV} eq 'development' ) {
65+
$urlmap->map( '/v1' => MetaCPAN::Server->app );
66+
}
67+
$urlmap->map( '/' => MetaCPAN::Server->app );
6568

6669
return $urlmap->to_app;

cpanfile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,6 @@ requires 'Plack', '1.0048';
115115
requires 'Plack::App::Directory';
116116
requires 'Plack::Middleware::Header';
117117
requires 'Plack::Middleware::ReverseProxy';
118-
requires 'Plack::Middleware::Rewrite';
119118
requires 'Plack::Middleware::Session';
120119
requires 'Plack::Session::Store';
121120
requires 'Pod::Markdown', '3.300';
@@ -167,5 +166,4 @@ requires 'Test::Routine', '0.012';
167166
requires 'Test::Vars', '0.015';
168167

169168
# author requirements
170-
requires 'Plack::Middleware::Rewrite';
171169
requires 'App::perlimports';

cpanfile.snapshot

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6109,18 +6109,6 @@ DISTRIBUTIONS
61096109
Test::More 0
61106110
parent 0
61116111
perl 5.008001
6112-
Plack-Middleware-Rewrite-2.102
6113-
pathname: A/AR/ARISTOTLE/Plack-Middleware-Rewrite-2.102.tar.gz
6114-
provides:
6115-
Plack::Middleware::Rewrite 2.102
6116-
requirements:
6117-
Plack 0.9942
6118-
Plack::Middleware 0
6119-
Plack::Request 0
6120-
Plack::Util 0
6121-
Plack::Util::Accessor 0
6122-
overload 0
6123-
perl 5.006
61246112
Plack-Middleware-Session-0.34
61256113
pathname: M/MI/MIYAGAWA/Plack-Middleware-Session-0.34.tar.gz
61266114
provides:

lib/MetaCPAN/Server.pm

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,10 +107,6 @@ sub app {
107107
};
108108
};
109109

110-
if ( $ENV{PLACK_ENV} && $ENV{PLACK_ENV} eq 'development' ) {
111-
enable 'Rewrite', rules => sub {s{^/?v\d+/}{}};
112-
}
113-
114110
$class->apply_default_middlewares( $class->psgi_app );
115111
};
116112
}

0 commit comments

Comments
 (0)