1.0.18 • Published 8 years ago
baxioql v1.0.18
baxioql
GraphQL client that uses axios under the hood.
Installation
Use your usual package manager.
npm install baxioql
Usage
import baxioql from 'baxioql';
// Set the endpoint that will be used for all your GraphQL requests
baxioql.setQLEndpoint('https://graphql.server.com/graphql');
// If you have to authenticate use this method to set the header
baxioql.setAuthHeader('Authentication', 'token');
// Create a query
const someQuery = `query ($searchText: String!) {
productSearch(title: $searchText) {
id
title
brand
}
}`;
// Add variables used by the query
const someVariables = {
searchText: 'Milk',
};
const yourAsyncMethod = async () => {
try {
// Fetch your data
const response = await baxioql.request({ query: someQuery, variables: someVariables });
console.log(response.data.data);
} catch (error) {
console.error(error);
}
};
1.0.18
8 years ago
1.0.17
8 years ago
1.0.16
8 years ago
1.0.15
8 years ago
1.0.14
8 years ago
1.0.13
8 years ago
1.0.12
8 years ago
1.0.11
8 years ago
1.0.10
8 years ago
1.0.9
8 years ago
1.0.8
8 years ago
1.0.7
8 years ago
1.0.6
8 years ago
1.0.5
8 years ago
1.0.4
8 years ago
1.0.3
8 years ago
1.0.2
8 years ago
1.0.1
8 years ago
1.0.0
8 years ago