* Dancer::Plugin::RPC ==> Example

* This example app has 5 functions grouped in 2 groups:
    system:   ping, version, status, list_methods
    metacpan: search (query => $query)
These 5 functions are reachable with 3 different protocols (xmlrpc, jsonrpc2
and restrpc) on the same daemon.

* Dependencies
This example code uses some extra dependencies, I've stated all of them in the cpanfile.
To install these dependencies in the local directory using Carton:

    $ cd example
    $ carton install

This installs all dependencies in the example/local directory.

* Start Example app
Start the Example daemon (simple way it's a Deamon::Control wrapper`):

    $ cd example
    $ carton exec -- bin/example.pl <start | foreground>

* Testing Example app
Testing the daemon (with bin/do-rpc):

    $ cd example

Any of:

    $ bin/do-rpc -t xmlrpc -u http://localhost:3000/system -c status
    $ bin/do-rpc -t jsonrpc -u http://localhost:3000/system -c status
    $ bin/do-rpc -t restrpc -u http://localhost:3000/system -c status
    $ bin/do-rpc -t restrpc -u http://localhost:3000/system/status (same thing)

    $ bin/do-rpc -t xmlrpc -u http://localhost:3000/system -c ping
    $ bin/do-rpc -t jsonrpc -u http://localhost:3000/system -c ping
    $ bin/do-rpc -t restrpc -u http://localhost:3000/system/ping

    $ bin/do-rpc -t xmlrpc -u http://localhost:3000/system -c version
    $ bin/do-rpc -t jsonrpc -u http://localhost:3000/system -c version
    $ bin/do-rpc -t restrpc -u http://localhost:3000/system/version

    $ bin/do-rpc -t xmlrpc -u http://localhost:3000/system -c list_methods
    $ bin/do-rpc -t jsonrpc -u http://localhost:3000/system -c list_methods
    $ bin/do-rpc -t restrpc -u http://localhost:3000/system/list_methods

    $ bin/do-rpc -t xmlrpc -u http://localhost:3000/metacpan -c rpc.search \
        query Dancer::Plugin::RPC
    $ bin/do-rpc -t jsonrpc -u http://localhost:3000/metacpan -c rpc_search \
        query Dancer::Plugin::RPC
    $ bin/do-rpc -t restrpc -u http://localhost:3000/metacpan/search \
        query Dancer::Plugin::RPC

* Stop Example app
Stop the Example daemon (simple way):

    $ cd example
    $ carton exec -- bin/example.pl stop

Or just press ^C if you started the daemon in the foreground.

* Different port
As 3000 seems a popular port, one can also run the example-deamon on a different port:

    $ APP_PORT=3456 carton exec -- bin/example.pl <start | foreground>