Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Getting started with GraphQL
Search
Thiago Colares
November 24, 2017
Technology
0
300
Getting started with GraphQL
The 4th Weekly company-internal Agilize DevTalk of November, 2017.
Thiago Colares
November 24, 2017
Tweet
Share
More Decks by Thiago Colares
See All by Thiago Colares
Functional programming: basic concepts you can start using today
thicolares
0
21
O básico que ainda deveríamos entender sobre Unicode e encondings
thicolares
0
330
The pragmatic agilist
thicolares
0
340
The Pragmatic Agilist
thicolares
0
40
Domain-Driven Design com PHP
thicolares
0
390
Other Decks in Technology
See All in Technology
バクラクにおける可観測性向上の取り組み
yuu26
2
230
日経ビジュアルデータにおける スクロールテリングと地図/nikkei-tech-talk-26
nikkei_engineer_recruiting
0
160
Oracle Base Database Service 技術詳細
oracle4engineer
PRO
5
49k
AWS re:Inventを徹底的に楽しむためのTips / Tips for thoroughly enjoying AWS re:Invent
yuj1osm
0
180
キーワードの再整理のススメ ~テストタイプ/テストレベルで最適化!~/20241025 Midori Inada
shift_evolve
0
120
GitHub Universe: Evaluating RAG apps in GitHub Actions
pamelafox
0
130
Databricksで構築する初めての複合AIシステム - ML15min
taka_aki
2
1.3k
Vueで Webコンポーネントを作って Reactで使う / 20241030-cloudsign-vuefes_after_night
bengo4com
3
180
AWS SAW(AWS Support Automation Workflows)をもっと広めたい
kazzpapa3
2
170
とあるユーザー企業におけるリスクベースで考えるセキュリティ業務のお話し
4su_para
0
250
2024-10-30-reInventStandby_StudyGroup_Intro
shinichirokawano
1
230
独自ツール開発でスタジオ撮影をDX!「VLS(Virtual LED Studio)」 / dx-studio-vls
cyberagentdevelopers
PRO
0
110
Featured
See All Featured
Why Our Code Smells
bkeepers
PRO
334
57k
Imperfection Machines: The Place of Print at Facebook
scottboms
264
13k
Building a Scalable Design System with Sketch
lauravandoore
459
33k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
92
16k
Designing for Performance
lara
604
68k
A better future with KSS
kneath
238
17k
A Modern Web Designer's Workflow
chriscoyier
692
190k
What’s in a name? Adding method to the madness
productmarketing
PRO
22
3.1k
The MySQL Ecosystem @ GitHub 2015
samlambert
250
12k
RailsConf 2023
tenderlove
29
870
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
37
1.8k
Docker and Python
trallard
40
3k
Transcript
GETTING STARTED WITH GraphQL Agilize Cloud Accounting, 24/11/2017 Weekly company-internal
DevTalks
Hallo! I’M THIAGO COLARES Agile manager Full stack developer Open
source Co-founder @ Agilize Cloud Accounting @thicolares
1. DEFINE: GraphQL
WHAT IS GRAPHQL ◦ Declarative data fetching ◦ Alternative to
REST ◦ Single endpoint → responds to queries
/authors/<id> /authors/<id>/books /authors/<id>/followers 3 ENDPOINTS
query query query 1 SINGLE ENDPOINT
DEMO 1
2. CHARACTERISTICS
GraphQL TIMELINE ◦ Developed by Facebook on 2012 ◦ Presented
→ React.js Conf 2015 ◦ Is not for React Developers ◦ Other companies had the same initiative ◦ Netflix → Falcor ◦ Cousera → Now uses GraphQL
REST CHALLENGES ◦ Need for efficient data loading (mobile) ◦
Variety of different frontend frameworks ◦ Rapid feature development
GraphQL BENEFITS ◦ No mover over or underfetching ◦ Almost
non API if the interface changes ◦ Faster feedbacks cycles
INSIGHTFUL ANALYTICS ◦ Fine-grained info about what read data ◦
Evolving and deprecating API
3. KEY CONCEPTS
type Query { ... } type Mutation { ... }
type Subscription { ... } ROOT TYPE
query { User(id: 123) { name posts { title }
} } QUERY HTTP POST
{ "data": { "User": { "name": "Joston Muriel", "posts": [
{title: "Hello, it's me"} {title: "Lines in the sand"} ] } } } RESPONSE RESPONSE
SCHEMA ◦ Strong type system ◦ Schema as client-server contract
◦ Client and server can work independently ◦ Schema Definition Language
type Person { name: String! age: Int! } DEFINING SIMPLE
TYPES ! → required
type Person { name: String! age: Int! } ADDING A
RELATION type Post { title: String! author: Person! }
type Person { name: String! age: Int! posts: [Post!]! }
ADDING A HAS-MANY RELATION type Post { title: String! author: Person! }
DEMO 2
4. MUTATIONS
WRITING DATA WITH MUTATIONS ◦ A query too ◦ You
can ask for the returning fields ◦ Even nested ones
3 KINDS OF MUTATIONS ◦ creating new data ◦ updating
existing data ◦ deleting existing data
A MUTATION mutation { createPerson(name: "Bob", age: 36) { name
age } } Similar syntax. Mutation keyword. Special root field.
DEFINING A MUTATION type Mutation { createPerson(name: String!, age: String!)
Person! ... }
5. NODE EXAMPLE
DEMO 3
“ Nescit cedere
THANKS! Thiago Colares @thicolares