Async-Redis

 view release on metacpan or  search on metacpan

examples/pagi-chat/lib/ChatApp/HTTP.pm  view on Meta::CPAN

my $PUBLIC_DIR = abs_path(File::Spec->catdir(dirname(__FILE__), '..', '..', 'public'));

# Debug: print the public dir on load
print STDERR "[HTTP] PUBLIC_DIR = $PUBLIC_DIR\n";

my %MIME_TYPES = (
    html => 'text/html; charset=utf-8',
    css  => 'text/css; charset=utf-8',
    js   => 'application/javascript; charset=utf-8',
    json => 'application/json; charset=utf-8',
    png  => 'image/png',
    ico  => 'image/x-icon',
);

sub handler {
    return async sub {
        my ($scope, $receive, $send) = @_;
        my $path = $scope->{path} // '/';
        my $method = $scope->{method} // 'GET';

        if ($path =~ m{^/api/}) {



( run in 1.114 second using v1.01-cache-2.11-cpan-df04353d9ac )