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
GraphQl, Front queries made easy
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Igor Halfeld
December 01, 2018
Programming
2
57
GraphQl, Front queries made easy
How to deal with graphql on client-side
Igor Halfeld
December 01, 2018
Tweet
Share
More Decks by Igor Halfeld
See All by Igor Halfeld
Modular monoliths with fastify
igorhalfeld
0
200
How to migrate legacy frontend?
igorhalfeld
1
130
Patterns for perfect components in Vue.js
igorhalfeld
0
120
Clean Architecture no Front-end (update 2021-05-11)
igorhalfeld
0
67
Step by step I followed a career in software
igorhalfeld
0
710
Using AI to create memes
igorhalfeld
0
530
Deninho, the TS children
igorhalfeld
1
220
Micro Front-ends, what they don't tell you
igorhalfeld
0
400
CSS in JavaScripto, the anti-pattern that is good
igorhalfeld
1
110
Other Decks in Programming
See All in Programming
Xdebug と IDE による デバッグ実行の仕組みを見る / Exploring-How-Debugging-Works-with-Xdebug-and-an-IDE
shin1x1
0
260
Ruby and LLM Ecosystem 2nd
koic
1
1.4k
The free-lunch guide to idea circularity
hollycummins
0
380
野球解説AI Agentを開発してみた - 2026/02/27 LayerX社内LT会資料
shinyorke
PRO
0
370
[PHPerKaigi 2026]PHPerKaigi2025の企画CodeGolfが最高すぎて社内で内製して半年運営して得た内製と運営の知見
ikezoemakoto
0
310
RailsのValidatesをSwift Macrosで再現してみた
hokuron
0
140
GC言語のWasm化とComponent Modelサポートの実践と課題 - Scalaの場合
tanishiking
0
130
ローカルで稼働するAI エージェントを超えて / beyond-local-ai-agents
gawa
1
180
おれのAgentic Coding 2026/03
tsukasagr
1
120
LM Linkで(非力な!)ノートPCでローカルLLM
seosoft
0
270
PHP 7.4でもOpenTelemetryゼロコード計装がしたい! / PHPerKaigi 2026
arthur1
1
440
どんと来い、データベース信頼性エンジニアリング / Introduction to DBRE
nnaka2992
1
350
Featured
See All Featured
Collaborative Software Design: How to facilitate domain modelling decisions
baasie
0
180
Ruling the World: When Life Gets Gamed
codingconduct
0
180
WENDY [Excerpt]
tessaabrams
9
37k
Ethics towards AI in product and experience design
skipperchong
2
240
The agentic SEO stack - context over prompts
schlessera
0
720
SEO for Brand Visibility & Recognition
aleyda
0
4.4k
Side Projects
sachag
455
43k
Information Architects: The Missing Link in Design Systems
soysaucechin
0
850
Groundhog Day: Seeking Process in Gaming for Health
codingconduct
0
130
Prompt Engineering for Job Search
mfonobong
0
240
Build The Right Thing And Hit Your Dates
maggiecrowley
39
3.1k
Mind Mapping
helmedeiros
PRO
1
130
Transcript
GraphQl. Front-end queries made easy.
Igor Halfeld Software Engineer & Consultancy igorluiz.me - @IgorHalfeld
Conheça minha história. Onde tudo começou…
None
Objetivo. Onde eu quero chegar…
None
Vamos contextualizar. Como chegamos até aqui?
ZONA DARK SOAP REST #TRISTEZA #SEMCROSSFIT
"Analisarmos alternativas, como o REST. (…) Ficamos frustrados com as
diferenças entre os dados que queríamos e as requests que eram necessárias para obtê-los.” Lee Byron
2012. GraphQl é criado pelo Facebook apenas para uso interno.
2015. É liberado como open source!
Que rolê é esse?
Duas partes. Consumir no front-end e fazer no back-end. *dar
uma olhada nos conceitos antes.
GraphQl Server Data Sources Clients JSON bonitão lindão GraphQl Queries
Resolvers
None
REST tem vários endpoints em que cada um retorna dados
fixos. GraphQl tem um único endpoint que retorna uma estrutura flexível.
REST GET - /users/:id { “name”: “Igor Halfeld”, “email”: “
[email protected]
”,
“state”: “RJ" } GraphQl POST - /graphql { “data”: { “name”: “Igor Halfeld” } } { query { Users (id: “666") { name } } }
3 pilares. Query, Mutation, Subscription.
REST GET GraphQl POST PUT DELETE Query Mutations
{ query { users { name, email } } }
{ query { users (id: “666”) { name, email } } } GET - /users/:id GET - /users
{ mutation { createUser ( name: "Igor Luiz”, email: “
[email protected]
"
) { name, email } } } CREATE - /users { mutation { updateUser ( name: “Halfeld Igor” ) { name, email } } } PUT - /users/:id
{ mutation { deleteUser (id: “666”) { name, email }
} } DELETE - /users
None
O que muda no front é… Basicamente, saber fazer GraphQl
SDL.
type Users { name: String! email: String! skills: [String]! addresses:
[Address] } type Address { street: String, number: Number } GraphQl SDL (Schema Definition Language)
{ Query { users (id: “666”) { name, height (unit:
METERS) } } } Resolvers <3
{ Query { users { admin (role: ADMIN) { …userFields
} accountants (role: ACCOUNTANT) { …userFields } } } } fragment userFields on User { user, name } Fragments
{ Query { users ($id: ID) { name, email }
} } { id: “666" } Variables
Client de GraphQl. Se é tudo POST, eu posso usar
o axios, certo?
Sim, mas não! Você precisa! Justamente para aproveitar melhor os
benefícios do graphql.
None
Certeza que vai fazer a query de forma certa. Cache
built-it: performance. Consistência na UI: Cache reativo.
None
None
None
Como tamo agora?
None
None
None
Tooling. Ferramental daóra.
None
None
GraphQl faker.
GraphQl Voyager.
DEMO TIME!
bit.ly/demo-floripa
Obrigado! igorluiz.me/talks - @IgorHalfeld