Git Product home page Git Product logo

graphql_tutorial's Introduction

Used GraphQL to fetch data

GraphQL Overview

download

GraphQL is a query language and runtime for APIs that enables clients to request exactly the data they need, and nothing more. It was developed by Facebook and released as an open-source project. Unlike traditional REST APIs, which expose a fixed set of endpoints for each resource, GraphQL allows clients to request only the specific data they need for a given operation.

Benefits of Using GraphQL

  1. Precise Data Retrieval:

    • Clients can request exactly the data they need, avoiding over-fetching or under-fetching of data. This helps reduce the amount of unnecessary data transferred over the network.
  2. Reduced Over-fetching:

    • With REST, endpoints often return more data than the client needs. GraphQL eliminates this issue by allowing clients to specify the shape of the response.
  3. Fewer Network Requests:

    • In REST, clients might need to make multiple requests to different endpoints to fetch related data. GraphQL allows clients to request all the necessary data in a single query.
  4. Versionless API Development:

    • Since clients request only the fields they need, there's no need to version the API. You can add or change fields without breaking existing clients.
  5. Strongly Typed Schema:

    • GraphQL uses a schema definition language to define the types and relationships in the API. This provides a clear and self-documenting contract between the client and server.
  6. Graphical Query Tool (GraphiQL):

    • GraphQL comes with a built-in tool called GraphiQL, which provides an interactive environment for testing and exploring the API. It helps developers understand the schema and construct queries.
  7. Batching and Caching:

    • GraphQL allows batching of multiple queries into a single request. This can be especially useful for scenarios where multiple pieces of data are needed at once. Additionally, caching can be more efficient as the response format is consistent.
  8. Real-time Updates with Subscriptions:

    • GraphQL supports real-time updates through subscriptions. This allows clients to subscribe to specific events and receive updates in real-time.
  9. Introspection and Documentation:

    • GraphQL APIs are self-documenting. Clients can query the schema to retrieve information about the types, fields, and operations available. This makes it easier for developers to understand and work with the API.
  10. Flexibility in Client Development:

    • Clients have the flexibility to request data in the format that suits their specific use case. This can lead to more efficient and performant client applications.
  11. Parallel Execution of Resolvers:

    • GraphQL servers can execute resolvers in parallel, optimizing the response time. This is especially beneficial when dealing with complex queries.
  12. Better Error Handling:

    • GraphQL responses always have a 200 status code. Errors are handled within the errors field of the response, providing detailed information about what went wrong.

graphql_tutorial's People

Contributors

aditya-singhal03 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.