An example API server 

get '/product/:id' => sub {
    if( my $product = find_product( param('id') ) ) {
        return $product;
    }
    status 404;
    return { error => 'Not Found' };
};