Created
August 7, 2012 09:08
-
-
Save hatak/3283591 to your computer and use it in GitHub Desktop.
Simple server returns the json response
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use JSON; | |
use Plack::Request; | |
my $app = sub { | |
my $req = Plack::Request->new(shift); | |
my $res = $req->new_response(200); | |
$res->content_type('application/json'); | |
$res->body(encode_json(+{ | |
method => $req->method, | |
query_strings => $req->query_parameters->as_hashref, | |
body_parameters => $req->body_parameters->as_hashref, | |
message => 'Hello JSON World!', | |
})); | |
return $res->finalize; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment