AWS-Lambda

 view release on metacpan or  search on metacpan

examples/psgi/app.psgi  view on Meta::CPAN

use strict;
use warnings;
use utf8;
use Plack::Request;
use Plack::Builder;
use Data::Dumper;

return builder {
    mount '/foo' => sub {
        my $env = shift;
        my $req = Plack::Request->new($env);

        my $meth = $req->method;
        if ($meth eq 'POST') {
            return [
                200,
                ['Content-Type', 'application/octet-stream'],
                [$req->content],
            ]
        }

        return [
            405,
            ['Content-Type', 'text/plain'],
            ['Method Not Allowed'],
        ]
    };
    mount '/' => sub {
        my $env = shift;
        return [
            200,
            ['Content-Type', 'text/plain'],
            [Dumper($env)],
        ]
    };
};



( run in 1.722 second using v1.01-cache-2.11-cpan-f56aa216473 )