Q2: How does GraphQL differ from a traditional REST API?
In REST, endpoints represent resources (e.g., /users, /posts), and data structure is fixed by the server. GraphQL uses a single endpoint (typically /graphql) where clients post a structured query specifying the exact response shape.
REST vs GraphQL Comparison
Multiple resource URIs
REST requires multiple network calls for relational data.
Single endpoint
GraphQL executes complex declarative queries at one endpoint.
Server defines payload
REST payload structure is static.
Client defines payload
GraphQL response reflects requested schema fields.
REST relies on multiple resource endpoints, while GraphQL operates over a single endpoint.
GraphQL gives the client total control over response shape.
What is the typical network architecture for a standard GraphQL server?