WebAPI::DBIC WebAPI::DBIC
Jul 17, 2015
RESTful ToolKitRESTful ToolKitA Series of useful Moo::RolesEach providing a specific part ofthe wholeHandling for Sets and ItemsBuilt with DBIx::Class
Strong foundationsStrong foundationsWeb::Machine - HTTP StateEnginePlack - Light, extensible HTTPServerPath::Router - Reversible urihandling
Incomprehensive ImageIncomprehensive Image
WebAPI::DBIC::WebAPP
WebAPI::DBIC::Resource::Item
WebAPI::DBIC::Resource::Set
DBIx::Class::ResultSource
Plack
Auto ConfigurationAuto ConfigurationSensible defaultsExposes all DBIX ResultSourcesProvides HTTP Verb supportRange of Data Serializers basedon Accept: headersHandles HTTP State automagically
Structure OldStructure OldController - Handles Routing,HTTP validation, Domain modelsetup, handles ViewModel - Handles business logic,dataView - Handles data serialization
Structure NewStructure NewRouter - Handles the paths to eachresourceResource - Handles the actualRequestDBIC ResultSource - Handlesbusiness logic, data
MyApp- Controllers - Auth - Note - Healthcheck- Model - Note- Exception- Schema - Result - Note
MyApp- Resource - Note - Notes- Schema - Result - Note
package MyApp::Resource::Note;
use Moo;
extends 'WebAPI::DBIC::Resource::GenericItem';
sub forbidden { my ($self) = @_;
my $headers = $self->request->headers; return 1 unless $headers->authorization_basic;
my ($username, $password) = $headers->authorization_basic; return 1 unless # Some check for userpass auth
return 0; # Is Authorized}