Skip to content

Instantly share code, notes, and snippets.

@issm
Created March 13, 2013 11:02
Show Gist options
  • Save issm/5151116 to your computer and use it in GitHub Desktop.
Save issm/5151116 to your computer and use it in GitHub Desktop.
diff --git a/app.psgi b/app.psgi
index d2ba7ef..23b090d 100644
--- a/app.psgi
+++ b/app.psgi
@@ -10,9 +10,14 @@ my $root_dir = File::Basename::dirname(__FILE__);
my $app = HRForecast::Web->psgi($root_dir);
builder {
enable 'ReverseProxy';
- enable 'Static',
- path => qr!^/(?:(?:css|js|images)/|favicon\.ico$)!,
- root => $root_dir . '/public';
- $app;
+ mount '/hf/' => builder {
+ enable 'Static',
+ path => qr!^/(?:(?:css|js|images)/|favicon\.ico$)!,
+ root => $root_dir . '/public';
+ $app;
+ };
+ mount '/' => sub {
+ return [ 404, [ 'Content-Type' => 'text/plain' ], [ 'not found' ] ];
+ };
};
diff --git a/lib/HRForecast/Web.pm b/lib/HRForecast/Web.pm
index 64df390..07810eb 100644
--- a/lib/HRForecast/Web.pm
+++ b/lib/HRForecast/Web.pm
@@ -10,6 +10,19 @@ use HRForecast::Data;
use Log::Minimal;
use JSON qw//;
+{
+ package Kossy::Request;
+ no warnings 'redefine';
+ sub uri_for {
+ my($self, $path, $args) = @_;
+ my $uri = $self->base;
+ my $base = '/hf';
+ $uri->path( $base . $path );
+ $uri->query_form(@$args) if $args;
+ $uri;
+ }
+}
+
my $JSON = JSON->new()->ascii(1);
sub encode_json {
$JSON->encode(shift);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment