Q1: What is GraphQL and what primary problem does it solve?
GraphQL is an open-source query language for APIs and a runtime for fulfilling those queries with existing data. Developed by Facebook in 2012 and open-sourced in 2015, it provides a complete and understandable description of the data in your API.
Primary problems solved:
- Over-fetching: Clients receive only the specific fields they request.
- Under-fetching: Multiple nested resources can be retrieved in a single request instead of round-tripping to multiple endpoints.
- Strong Typing: The API schema serves as a strict contract between client and server.
Specifications & Requirements
- Creator:
Facebook (Meta) - Initial Release:
2015
Key Takeaways
- GraphQL allows clients to request exactly what data they need.
- It eliminates over-fetching and under-fetching using a single endpoint.
Knowledge Check
Which issue is directly eliminated by GraphQL allowing field-level selection?