An example API server 

package ProductsAPI;
use Dancer;

set("serializer", "JSON");

get '/product/:id' => sub {
    my $product = find_product( param('id') );
    return $product;
};

dance;