Heart Disease Prediction using machine learning.pptx
GraphQL.pptx
1. 1
WHAT IS GraphQL
GraphQL - https://graphql.org/
GraphQL is an open-source data query and manipulation language for APIs, and a runtime for fulfilling queries with
existing data. Maintained and developed primarily via the GraphQL Foundation, GraphQL has had incredible adoption
across a variety of verticals and use cases with organizations like Twitter, Expedia, Shopify, and Hygraph to name a few.
GraphQL is a query language. GraphQL provides a complete and understandable description of the data in your API,
gives clients the power to ask for exactly what they need and nothing more, makes it easier to evolve APIs over time,
and enables powerful developer tools.
Send a GraphQL query to your API and get exactly what you need, nothing more and nothing less. GraphQL queries
always return predictable results. Apps using GraphQL are fast and stable because they control the data they get, not
the server.
2. 5/19/2023 2
GRAPQL VS REST API
The core difference between GraphQL and REST APIs is that GraphQL is a specification, a query
language, while REST is an architectural concept for network-based software.
GraphQL queries access not just the properties of one resource but also smoothly follow references
between them. While typical REST APIs require loading from multiple URLs, GraphQL APIs get all the
data your app needs in a single request. Apps using GraphQL can be quick even on slow mobile
network connections.
GraphQL is gaining momentum as a successor to REST APIs. However, it isn’t always a “replacement”,
and making the decision to opt for GraphQL comes with several considerations. Traditionally and when
used “out of the box”, REST has had limitations like multiple network requests and overfetching data.
To overcome these, Facebook developed GraphQL as an open-source data query and manipulation
language for APIs. GraphQL is a syntax for requesting data and lets you specify precisely what you
need.
Depending on your use cases, you will need to choose between GraphQL or REST API, or a combination
of both. To make a more informed decision, let’s take a look at REST and GraphQL, and understand
some of the reasons for choosing GraphQL.
Rest Api
GraphQL
3. 5/19/2023 3
GraphQL VS REST API
GraphQL REST API
A query language for solving common problems when integrating APIs An architectural style largely viewed as a conventional standard for
designing APIs
Deployed over HTTP using a single endpoint that provides the full
capabilities of the exposed service
Deployed over a set of URLs where each of them exposes a single resource
Uses a client-driven architecture Uses a server-driven architecture
Lacks in-built caching mechanism Uses caching automatically
No API versioning required Supports multiple API versions
Response output in JSON Response output usually in XML, JSON, and YAML
Offers type-safety and auto-generated documentation Doesn't offer type-safety or auto-generated documentation
Allows for schema stitching and remote data fetching Simplifying work with multiple endpoints requires expensive custom
middleware
5. 5/19/2023 5
GraphQL Advantages
• Data Fetching
One of the most common limitations of REST out-of-the-box is that of overfetching and underfetching.
This happens because the only way for a client to download data is by hitting endpoints that return fixed data sets.
It’s very difficult to design the API in a way that it’s able to provide clients with their exact data needs.
Overfetching means getting more information than you need.
With GraphQL, you’d simply need to dictate what you want in a query
• Schema Stitching
A major differentiation is the ability for stitching schemas. GraphQL can combine multiple schemas into a
single schema to make it accessible to the client. For example, merging the schemas of a Burgers API and a
Nutrition API by getting the details of a particular menu and the nutrition facts of the item into a single
schema, from different sources.