API Fundamentals
/Intermediate
GraphQL vs REST
Definition
Comparing the two dominant Web API architectures. REST relies on multiple endpoints returning fixed data structures. GraphQL relies on a single endpoint returning dynamic, client-defined data structures.
Explain Like I'm New
REST is a set menu at a restaurant. You order the 'Burger Meal' (Endpoint), and you get a burger, fries, and a drink, whether you want them or not. GraphQL is a buffet. You walk up to one counter (Single Endpoint) and put exactly 3 fries and half a burger on your plate.
Real World Example
To show a blog dashboard, a REST app makes 3 requests: `/user`, `/posts`, and `/followers`. A GraphQL app makes 1 request to `/graphql` asking for the user, their posts, and their followers all at once.
Common Use Cases
- •Architecture decisions
Interactive Example
Loading...
Console output will appear here...
Interview Questions
basic
- How many Endpoints (URLs) does a standard GraphQL API usually expose?
intermediate
- Why is HTTP Caching inherently harder in GraphQL compared to REST?