This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Mike F - mrf Friday, 25 July 14
Automated RESTful DB Mike F - mrf Friday, 25 July 14
Mike F - mrf Friday, 25 July 14
Friday, 25 July 14
REST Friday, 25 July 14
REST Client-Server Friday, 25 July 14
REST Client-Server Stateless Friday, 25 July 14
REST Client-Server Stateless Cacheable Friday, 25 July 14
REST Client-Server Stateless Cacheable Layered Friday, 25 July
14
Web::Machine Based on Erlang and Pythons WebMachines Automatic
Handling of Status Understands HTTP ow Friday, 25 July 14
Friday, 25 July 14
sub content_types_provided { [ {'application/json' =>
'to_json'}, ]; } sub to_json { my $self = shift; return 404 unless
$response; # A status code was returned return $response if ref
$response eq 'SCALAR'; return JSON::to_json($response), } Friday,
25 July 14
sub get_data { my ($self) = @_; my $params =
$self->db_params; my $page = delete $params->{page} // 1; my
$rows = delete $params->{page_size} // 10; my $resultset =
$self->db_schema->resultset($self->db_table); for my
$param (keys %$params){ return 400 unless
$resultset->result_source->has_column($param); } my $results
= $resultset->search( $params, {page => $page, rows =>
$rows} ); return $self->serialise_results( $results, $params,
$results->pager, $rows ); } Friday, 25 July 14
Problems No routing in Web::Machine What is a Resource? An Row
or a Resultset POST to non existent resource Business logic Friday,
25 July 14
TODO Routing in Web::Machine Resource on the y creation Allow
business override/callbacks Methods for Hypermedia control between
related resources. Friday, 25 July 14