diff options
author | Matthew Somerville <matthew-github@dracos.co.uk> | 2016-10-21 14:49:37 +0100 |
---|---|---|
committer | Matthew Somerville <matthew-github@dracos.co.uk> | 2016-10-21 14:49:37 +0100 |
commit | 3617fbf4ee622fce7961e4687d2a9b5c9312faa9 (patch) | |
tree | 972aa92bd39fe3eb3a162f2719d4479063558e85 /perllib/FixMyStreet/App/Controller/FakeMapit.pm | |
parent | aef97ce9d654422672f701bcf4f1a375e0d7d3ad (diff) |
Add server-side /mapit proxy.
Diffstat (limited to 'perllib/FixMyStreet/App/Controller/FakeMapit.pm')
-rwxr-xr-x | perllib/FixMyStreet/App/Controller/FakeMapit.pm | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/perllib/FixMyStreet/App/Controller/FakeMapit.pm b/perllib/FixMyStreet/App/Controller/FakeMapit.pm index a4adadd09..0ec13ebfa 100755 --- a/perllib/FixMyStreet/App/Controller/FakeMapit.pm +++ b/perllib/FixMyStreet/App/Controller/FakeMapit.pm @@ -2,6 +2,7 @@ package FixMyStreet::App::Controller::FakeMapit; use Moose; use namespace::autoclean; use JSON::MaybeXS; +use LWP::Simple; BEGIN { extends 'Catalyst::Controller'; } @@ -21,6 +22,16 @@ world is one area, with ID 161 and name "Everywhere". my $area = { "name" => "Everywhere", "type" => "ZZZ", "id" => 161 }; +# The user should have the web server proxying this, +# but for development we can also do it on the server. +sub proxy : Path('/mapit') { + my ($self, $c) = @_; + (my $path = $c->req->uri->path_query) =~ s{^/mapit/}{}; + my $url = FixMyStreet->config('MAPIT_URL') . $path; + my $kml = LWP::Simple::get($url); + $c->response->body($kml); +} + sub output : Private { my ( $self, $c, $data ) = @_; my $body = encode_json($data); |