簡素なJSON-RPCサーバーを作ってみた

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
use Plack::App::JSONRPC;
use Plack::Builder;

my $jsonrpc = Plack::App::JSONRPC->new(
    methods => {
        echo  => sub { $_[0] },
        empty => sub {''}
    }
);
my $app = sub {
    [200, ['Content-Type' => 'text/plain'], ['Hello']];
};
builder {
    mount '/jsonrpc', $jsonrpc->to_app;
    mount '/' => $app;
};

Comments

comments powered by Disqus