GraphQL when clients need flexible, nested views of interconnected data (mobile app, slow network); REST for simple resources where HTTP caching and simplicity matter.
6
New cards
Write a GraphQL query for user 1's name and last 2 orders (id, total).
query { user(id: 1) { name orders(last: 2) { id total } } } — one request to POST /graphql.