The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Example::EndpointConfig - Takes away the details of Dancer::Plugin::RPC

SYNOPSIS

use Dancer ':syntax';
use Bread::Board;
use Example::EndpointConfig;
my $config = Example::EndpointConfig->new(
    publish     => 'pod',
    bread_board => container(
        app => as {
            container apis => as {
                service 'Example::API::MetaCpan' => as (
                    class => 'Example::API::MetaCpan',
                    dependencies => {
                        # attributes needed for instantiation
                        # or objects from the same container
                        mc_client => '../clients/Client::MetaCpan',
                    },
                ),
            };
            container clients => as {
                service 'Client::MetaCpan' => as (
                    class => 'Client::MetaCpan',
                    dependencies => {
                        base_uri => literal config->{base_uri},
                ),
            };
        };
    ),
);

$config->register_endpoint('RPC::JSONRPC' => '/metacpan');
$config->register_endpoint('RPC::XMLRPC'  => '/metacpan');

ATTRIBUTES

publish [required]

This attribute can have the value of config or pod, it will be bassed to Dancer::Plugin::RPC

callback [optional]

This attribute is passed directly to Dancer::Plugin::RPC

bread_board [required]

This is an instatiated Bread::Board::Container object, that defines the components of this service and their interaction.

code_wrapper [optional/lazy]

The code-wrapper is passed to Dancer::Plugin::RPC. The default code-wrapper uses the Bread::Board::Container to spawn the code for the Remote-Procedure-Call.

plugin_arguments [optional]

This hashref is directly passed to Dancer::Plugin::RPC

DESCRIPTION

endpoint_config($path)

Returns a config-hash for the Dancer::Plugin::RPC::* plugins.

register_endpoint($plugin, $path)

COPYRIGHT

(c) MMXIX - Abe Timmerman <abeltje@cpan.org>