https://github.com/nkg447/graphql-app-int
https://github.com/nkg447/graphql-app-int
graphql oas-to-graphql openapi-to-graphql rest-api swagger swagger-to-gra
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/nkg447/graphql-app-int
- Owner: nkg447
- Created: 2022-12-28T11:55:37.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2023-02-16T17:08:49.000Z (over 3 years ago)
- Last Synced: 2025-07-05T14:44:45.209Z (about 1 year ago)
- Topics: graphql, oas-to-graphql, openapi-to-graphql, rest-api, swagger, swagger-to-gra
- Language: JavaScript
- Homepage:
- Size: 341 KB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Integrate Rest APIs with GraphQL
Integrate multiple Rest APIs with GraphQl and reduce your api calls.
## Example
Consider you have these 3 APIs.
* http://amazon.com/getOrderById
* http://amazon.com/getProductById
* http://amazon.com/getSupplierById
Now to fetch the supplier name of an order id. You would perform following steps.
1. Get Order details from getOrderById.
2. Get Product details form getProductById using the productId received from step 1.
3. Get Supplier details from getSupplierById using the supplierId received form step 2.
But if you integrate your APIs with GraphQL. All you need to do is send the following graphql request.
```graphql
query{
getOrderById(id: $orderId){
date
product{
name
supplier{
name
}
}
}
}
```
And this will give you a response like -
```json
{
"getOrderById": {
"date": "10-12-2021",
"product": {
"name": "PS5",
"supplier": {
"name": "Sony"
}
}
}
}
```