Presentation tim numann

47
Eco Chain How Flow Helps Us Save The World

Transcript of Presentation tim numann

Page 1: Presentation tim numann

EcoChain

How Flow Helps Us Save The World

Page 2: Presentation tim numann

Introduction

Page 3: Presentation tim numann

Hi, I’m Tim NumanInteraction designer, product design, frontend-development, doing web stuff since 1999@TimNuman

EcoChain

Page 4: Presentation tim numann

A Social Network for SustainabilityWorking together is needed to create real change

EcoChain

Page 5: Presentation tim numann

EcoChain

1 2 3Map company emissions

Map Emissions to Processes

Map Processesto Products Share your results

Page 6: Presentation tim numann

“In this talk, a fully working

and operational real-world

TYPO3 Flow application will

be demonstrated”

EcoChain

Page 7: Presentation tim numann

OOPS.

EcoChain

Page 8: Presentation tim numann

Backend & FrontendA two part presentation

EcoChain

Page 9: Presentation tim numann

Part 1 - REST APIChallenges while building a scalable REST API using TYPO3 Flow

Page 10: Presentation tim numann

26 years old, freelance software engineer, TYPO3 CMS, TYPO3 Flow, Continuous Delivery, Involved since June 2012

Jesper Paardekooper

EcoChain

jesperp on #typo3-flow@jesperp87

Page 11: Presentation tim numann

Current & NewPlatform architecture

EcoChain

Page 12: Presentation tim numann

TYPO3 Flow backend67 API calls54 domain models167 Behat tests

Facts & Figures

EcoChain

Page 13: Presentation tim numann

AuthenticationRetrieving dataUpdating data

Challenges

EcoChain

Page 14: Presentation tim numann

Authentication in Frontend #1

EcoChain

POST api.local/authenticate

POST frontend.local/authentication/login

EcoChainUserTokenProvider

EcoChainUserToken

Page 15: Presentation tim numann
Page 16: Presentation tim numann

Authentication in Frontend #2

EcoChain

GET api.local/usersHEADER EcoChain-Token: topsecrettoken

Page 17: Presentation tim numann
Page 18: Presentation tim numann
Page 19: Presentation tim numann
Page 20: Presentation tim numann

54 domain objectsAlot of relationsFlexible way of retrieving data

Retrieving data: The challenge

EcoChain

Page 21: Presentation tim numann

Return all linked objects by default,including ManyToMany collections

Retrieving data: The Bad Solution

EcoChain

Page 22: Presentation tim numann

16 second authentication calls :(Retrieving data: The Bad Solution

EcoChain

Page 23: Presentation tim numann

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

Page 24: Presentation tim numann
Page 25: Presentation tim numann

"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

Page 26: Presentation tim numann

Require all fields in the domain object (except private ones)Replaces the existing domain object

Updating using PUT

EcoChain

Page 27: Presentation tim numann

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

Page 28: Presentation tim numann

CachingAPI authentication beyond headersMultiple storage backends

Future challenges

EcoChain

Page 29: Presentation tim numann

Part 2 - AngularJSBuilding a single page applicationwith AngularJS and TYPO3 Flow

Page 30: Presentation tim numann

Say what?

www.angularjs.org

AngularJS

EcoChain

Page 31: Presentation tim numann

MV*RoutingDirectivesServices

EcoChain

Page 32: Presentation tim numann

What do we want?Install angular and supporting packages in FlowCreate a nice workflowGet a ‘hello’ with an end to end test

EcoChain

Page 33: Presentation tim numann

EcoChain

What do we need?

Protractor

Page 34: Presentation tim numann

Phew!

EcoChain

Page 35: Presentation tim numann
Page 36: Presentation tim numann
Page 37: Presentation tim numann
Page 38: Presentation tim numann
Page 39: Presentation tim numann
Page 40: Presentation tim numann
Page 41: Presentation tim numann
Page 42: Presentation tim numann
Page 43: Presentation tim numann
Page 44: Presentation tim numann

g test:e2e

3 scenarios succeeded

Page 45: Presentation tim numann

EcoChain

High-tech demo time!(Sadly no lasers…)

Page 46: Presentation tim numann

EcoChain

Free stuff!https://github.com/jp1987/inspiring-conference-vagranthttps://github.com/jp1987/inspiring-conference-frontend

Page 47: Presentation tim numann

EcoChain

Thanks! Any questions?