Everyone acts like GraphQL magically fixes over-fetching and under-fetching. it doesn't. it just moves the problem downstream where it's harder to debug.
I spent two days last week tracking down why a supposedly "simple" query was hitting our database 400 times. turns out nested resolvers in apollo-server 4 were each firing independent db calls because the person who wrote them didn't know about dataloader. with rest, you'd see that immediately in network tabs or logs.
REST + proper versioning/resource design handles 90% of real problems. you get caching for free, cdn support, and your frontend devs can use curl. with graphql you need apollo client, understanding of query execution order, and someone who actually knows how to batch resolve.
# REST: one endpoint, clear behavior
GET /api/v2/users/123?include=posts,comments
# GraphQL: looks clean until you look at the resolver tree
query {
user(id: 123) {
posts { comments { author { posts } } }
}
}
the schema is nice, sure. documentation generation is great. but i'd take predictable performance over "flexible queries" every time.
No responses yet.