1.1.1 • Published 5 years ago
axios-graphql-builder v1.1.1
axios-graphql-builder
About
A light weight library to generate Axios`s GraphQL query from JSON.
Installation
Local installation
npm install axios-graphql-builder --save
Functionality Available
Usage
Once installed in your project. It can be used as:
Example:
import { buildQuery } from 'axios-graphql-builder'
const jsonInput = {
query: {
a: null,
b: null,
c: {
c1: null,
c2: null
}
}
}
const paramList = [{ key: 'a', param: 'id: 10' }]
const output = buildQuery(jsonInput, paramList)
console.log(output) >>> { "query": "query \n a(id: 10) \n b \n c { \n c1 \n c2 \n } \n " }
Output
- buildQuery: Return a GraphQl Query which can be directly passed into Axios.
Contact
- Author: Subhendu Kumar Sahoo
- Email: smaro.nitr@gmail.com
- Website: https://smaro-nitr.github.io
- Always welcome for a bugfix, feature suggestion, and feedback