GraphQL isn’t suddenly popular because it can do things REST can’t do
GraphQL isn’t suddenly popular because it can do things REST can’t do. REST isn’t a spec. So “REST” can theoretically do anything.
GraphQL is popular because it provides a clear path to building an API that does all the things that you likely need it to do.
With GraphQL, you no longer spend time arguing about HTTP verbs, response codes, URL structures, error handling, documentation generation, discovery, sparse fieldsets, and so on.
You follow the spec, and ship your app your app faster.
Want to learn GraphQL by example? Here’s a repo I made with multiple examples including how to quickly wrap your existing REST APIs with GraphQL: https://github.com/coryhouse/graphql
REST isn't a decision. It's too amorphous to be a choice. There's no spec. So saying "let's build a REST API" means basically nothing.
@jsonapi is a solid spec. But it's not "REST". The word REST isn't even in its docs.
So most teams:
1. Choose "REST"
2. Start arguing 🤦♂️
In contrast, GraphQL has a single, clear spec. So when you choose GraphQL, you have a clear target to hit. And you have a *cohesive ecosystem* of tools that follow the spec. 🎉
No more bike shedding on URLs, verbs, hypermedia...
Just build it. 🔥