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
380
0
Share
Getting started with GraphQL
The 4th Weekly company-internal Agilize DevTalk of November, 2017.
Thiago Colares
November 24, 2017
More Decks by Thiago Colares
See All by Thiago Colares
How pgvector extends PostgreSQL
thicolares
0
5
Functional programming: basic concepts you can start using today
thicolares
0
35
O básico que ainda deveríamos entender sobre Unicode e encondings
thicolares
0
420
The pragmatic agilist
thicolares
0
420
The Pragmatic Agilist
thicolares
0
40
Domain-Driven Design com PHP
thicolares
0
460
Other Decks in Technology
See All in Technology
Expiration of Secure Boot Certificates for vSphere Virtual Machines
mirie_sd
0
100
260420_スマートホーム採用説明 - wakinchan
wakinchan
0
120
小説執筆のハーネスエンジニアリング
yoshitetsu
0
730
Oracle AI Database@AWS:サービス概要のご紹介
oracle4engineer
PRO
4
2.4k
はじめての MagicPod生成AI機能 機能紹介から活用方法まで
magicpod
0
110
Shipping AI Agents — Lessons from Production
vvatanabe
0
270
PicoRuby as a Multi-VM Operating System
kishima
1
180
最近の技術系の話題で気になったもの色々(IoT系以外も) / IoTLT 花見予定会(たぶんBBQ) @都立潮風公園バーベキュー広場
you
PRO
1
240
AWS Agent Registry の基礎・概要を理解する/aws-agent-registry-intro
ren8k
3
390
明日からドヤれる!超マニアックなAWSセキュリティTips10連発 / 10 Ultra-Niche AWS Security Tips
yuj1osm
0
610
[最強DB講義]推薦システム | 基礎編
recsyslab
PRO
1
180
今年注目する!データ分析プラットフォームでのAIの活用
nayuts
0
140
Featured
See All Featured
Organizational Design Perspectives: An Ontology of Organizational Design Elements
kimpetersen
PRO
1
680
Gemini Prompt Engineering: Practical Techniques for Tangible AI Outcomes
mfonobong
2
370
Leadership Guide Workshop - DevTernity 2021
reverentgeek
1
270
The Power of CSS Pseudo Elements
geoffreycrofte
82
6.2k
The agentic SEO stack - context over prompts
schlessera
0
750
Google's AI Overviews - The New Search
badams
0
980
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
31
10k
Lessons Learnt from Crawling 1000+ Websites
charlesmeaden
PRO
1
1.2k
Mind Mapping
helmedeiros
PRO
1
160
Thoughts on Productivity
jonyablonski
76
5.1k
Ethics towards AI in product and experience design
skipperchong
2
260
GraphQLの誤解/rethinking-graphql
sonatard
75
12k
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