Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

astraql

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

astraql

Fast and easy to use GraphQL Client.

  • 0.1.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

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';

// 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`
    Character($id: Int) {
        Character(id: $id) {
            id
            name {
                first
                last
            }
            gender
            age
        }
    }
`;

// Send request.
client.fetch(characterQuery, { id: 128986 })
    .then(console.log);

As CJS Module

// If uses require function you will need to use .default
// For import in typescript, this is not required
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.

Keywords

FAQs

Package last updated on 20 Dec 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc