GoConqr has a new look! Let us know what you think.

Mind map

GraphQL

Jose Miguel Tobon Spanish

Map content

GraphQL

  1. query language for APIs that allows clients to request exactly the data they need

    • Unlike REST, where multiple endpoints can return unnecessary data, GraphQL uses a single endpoint from which you can request and receive only the required data.
      • REPRESENTATIONAL STATE TRANSFER
        • REST operates over HTTP and treats web services as resources that can be accessed and manipulated using standard HTTP methods.
          • In REST, everything is considered a resource. Resources are identified by URLs (Uniform Resource Locators).
        • REST vs GraphQL: Fixed endpoints: REST APIs have specific endpoints for each resource or action (e.g., /users, /users/123, /users/123/posts). Versioning: REST APIs often need versioning (e.g., /v1/users) to handle changes over time. Over-fetching/Under-fetching: REST can result in over-fetching (getting more data than needed) or under-fetching (missing certain data), which is a limitation addressed by GraphQL.
    • Efficiency: Solves the problem of over-fetching and under-fetching data.
    • Flexibility: Clients can specify the exact data they need.
    • Optimization: Multiple resources can be fetched in a single request.
  2. CRUD model

    • Queries: Retrieve specific data as requested by the client.
    • Mutations: Modify data (create, update, delete) within the system.
  3. CONCEPTS

    • Schema: The blueprint of your API, defining available data types and relationships.
      • Types: Define the structure of the data, ensuring clarity on what can be queried or modified.
    • Resolvers: Functions that handle fetching the actual data for queries or mutations.
    • Directives: Used to modify the behavior of queries or fields dynamically (e.g., to include or exclude data conditionally).
    • Fragments: Reusable pieces of query logic that simplify requesting similar sets of data.
  4. USE CASES

    • Microservices: Efficiently aggregate data from multiple services into a single API.
    • Complex APIs: Ideal for scenarios where clients need different subsets of data.
    • Mobile Applications: Minimize data usage by requesting only necessary data fields.
  5. BEST PRACTICES

    • Pagination: Prevent large data loads by implementing pagination for queries.
      • A node represents a single entity or object in your data.
      • Edges represent the connections between nodes.
        • metadata about the connection
      • A connection is the GraphQL pattern used to represent a relationship between nodes.
    • Caching: Implement caching to optimize repetitive data requests.
    • Authentication and Authorization: Requires careful planning to ensure proper access control.
  6. API: a set of functions and procedures allowing the creation of applications that access the features or data of an operating system, application, or other service.

Information

Description
Mind Map on GraphQL, created by Jose Miguel Tobon on 11/10/2024.
Views
1
Rating

Feedback

What is it about?

What do you think of the new look?

How do you like it?