Fast and easy to use GraphQL Client.
npm install astraqlFast and easy to use GraphQL Client.
``shellWith npm:
npm install astraql
📚 Usage
$3
`javascript
import { CacheLoader, GraphQLClient, query } from 'astraql';// Initialize client.
const client = new GraphQLClient({
endpoint: 'https://graphql.anilist.co',
// Optional authentication:
headers: {
'Authorization': 'bearer xxxxxxxxxxxx'
},
// Optional cache (in seconds)
cache: new CacheLoader({ expiresIn: 60 }),
});
// Create a query.
const characterQuery = query
;// Send request.
client.fetch(characterQuery, { id: 128986 })
.then(console.log);
`$3
`javascript
// If uses require function you will need to use .default
// For import in typescript, this is not required
const { GraphQLClient, query } = require('astraql').default;
``Contributions, issues and feature requests are welcome!
Feel free to check issues page.
Give a ⭐️ if this project helped you!
Or buy me a coffeelatte 🙌🏾