AstraQL
Fast and easy to use GraphQL Client.
💻 Getting started
# With npm:
npm install astraql
# With yarn:
yarn add astraql
📚 Usage
As a ES Module
import { CacheLoader, GraphQLClient, query } from 'astraql';
const client = new GraphQLClient({
endpoint: 'https://graphql.anilist.co',
headers: {
'Authorization': 'bearer xxxxxxxxxxxx'
},
cache: new CacheLoader({ expiresIn: 60 }),
});
const characterQuery = query`
Character($id: Int) {
Character(id: $id) {
id
name {
first
last
}
gender
age
}
}
`;
client.fetch(characterQuery, { id: 128986 })
.then(console.log);
As CJS Module
const { GraphQLClient, query } = require('astraql').default;
🤝 Contributing
Contributions, issues and feature requests are welcome!
Feel free to check issues page.
❤️ Show your support
Give a ⭐️ if this project helped you!
Or buy me a coffeelatte 🙌🏾
Ko-fi | Patreon
📝 License
Copyright © 2022 Sammwy.
This project is MIT licensed.