Eco Chain How Flow Helps Us Save The World
EcoChain
How Flow Helps Us Save The World
Introduction
Hi, I’m Tim NumanInteraction designer, product design, frontend-development, doing web stuff since 1999@TimNuman
EcoChain
A Social Network for SustainabilityWorking together is needed to create real change
EcoChain
EcoChain
1 2 3Map company emissions
Map Emissions to Processes
Map Processesto Products Share your results
“In this talk, a fully working
and operational real-world
TYPO3 Flow application will
be demonstrated”
EcoChain
OOPS.
EcoChain
Backend & FrontendA two part presentation
EcoChain
Part 1 - REST APIChallenges while building a scalable REST API using TYPO3 Flow
26 years old, freelance software engineer, TYPO3 CMS, TYPO3 Flow, Continuous Delivery, Involved since June 2012
Jesper Paardekooper
EcoChain
jesperp on #typo3-flow@jesperp87
Current & NewPlatform architecture
EcoChain
TYPO3 Flow backend67 API calls54 domain models167 Behat tests
Facts & Figures
EcoChain
AuthenticationRetrieving dataUpdating data
Challenges
EcoChain
Authentication in Frontend #1
EcoChain
POST api.local/authenticate
POST frontend.local/authentication/login
EcoChainUserTokenProvider
EcoChainUserToken
Authentication in Frontend #2
EcoChain
GET api.local/usersHEADER EcoChain-Token: topsecrettoken
54 domain objectsAlot of relationsFlexible way of retrieving data
Retrieving data: The challenge
EcoChain
Return all linked objects by default,including ManyToMany collections
Retrieving data: The Bad Solution
EcoChain
16 second authentication calls :(Retrieving data: The Bad Solution
EcoChain
Introduce “fields” parameterAllow multi level control over returned fields
users/?fields=firstName,lastNameusers/?fields=location.nameusers/?fields=location.country.name
Retrieving data: A scalable solution
EcoChain
"Several applications extending the Hypertext Transfer Protocol
(HTTP) require a feature to do partial resource modification. The
existing HTTP PUT method only allows a complete replacement of
a document. This proposal adds a new HTTP method, PATCH, to
modify an existing HTTP resource.“
Source: http://tools.ietf.org/html/rfc5789
Updating Resources
EcoChain
Require all fields in the domain object (except private ones)Replaces the existing domain object
Updating using PUT
EcoChain
Only update the properties providedMust trigger validation annotations
Request parameters not getting through in Flow!http://forge.typo3.org/issues/54600
Updating using PATCH
EcoChain
CachingAPI authentication beyond headersMultiple storage backends
Future challenges
EcoChain
Part 2 - AngularJSBuilding a single page applicationwith AngularJS and TYPO3 Flow
Say what?
www.angularjs.org
AngularJS
EcoChain
MV*RoutingDirectivesServices
EcoChain
What do we want?Install angular and supporting packages in FlowCreate a nice workflowGet a ‘hello’ with an end to end test
EcoChain
EcoChain
What do we need?
Protractor
Phew!
EcoChain
g test:e2e
3 scenarios succeeded
EcoChain
High-tech demo time!(Sadly no lasers…)
EcoChain
Free stuff!https://github.com/jp1987/inspiring-conference-vagranthttps://github.com/jp1987/inspiring-conference-frontend
EcoChain
Thanks! Any questions?