Frontend Developer in:
Przemek Fałowski
Who am I?
@przemkow
@przemkow
przemyslaw.falowski
Movies
Directors
Actors
Movies
/movies
Directors
/directors/:id
Actors
/actors/:id
/movies?include=
directors,
actors
đź‘Ź
GET /posts
POST /posts
DELETE /posts/:id
PATCH /posts/:id
...
Â
HTTP status codes:
- 200 Success
- 403 Forbidden
...
POST /graphql
200 Success
Query
Response
Â
Set of libraries which implement both a GraphQL server and client
Example time!
https://github.com/przemkow/microblog-example
Schema
Resolver
Schema
Resolver
Schema
Resolver
How to start?
1. Install react-apollo
2. Setup apollo client
3. Connect to your react app
So is only about a different way to fetch data from API?
🤔
JSON
Database
Component needs data
Dispatch Action
Component needs data
Write Query with required data
fetchPolicy:
manual cache update
HTTP batching
Batch multiple operations into a single HTTP request
Example: http-batching branch
Optimistic UI
Example: optimistic-
Developer Experience
Developer Experience
Support:
swift | typescript | flow | scala
Example: apollo-tooling
Problem:
Solution:
HTTP caching
Client side cache
N +1 problem
Using deferred resolver
ex. facebook/dataloader
Malicious queries
Timeout
Limit query depth
Define max query complexity