Prajithp / p5-gohttplib

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

p5-gohttplib

Shared library that exposes Go's net/http.Server with externally-bindable handlers. Originally developed by shazow(https://github.com/shazow/gohttplib).

Getting Started

Requirements:

Installation

perl Makefile.PL
make && make install 

Example:

#!/usr/bin/perl

use GoHttpLib;

my $app   = GoHttpLib->new();
my $route = $app->route;

$route->add('GET', '/test', sub {
    my ($c) = @_;
    $c->res->write("test");
});

$route->add('GET', '/', sub {
    my ($c) = @_;

    $c->res->set_header("content-type", "application/json");
    $c->res->write(encode_json({ ww => 1 }));
});

$app->run();

References & Credit

About


Languages

Language:Perl 37.8%Language:Go 33.7%Language:C 20.4%Language:Raku 6.7%Language:Shell 1.4%