Graphql-request

graphql-request

Minimal GraphQL client.

graphql-request is a minimal GraphQL promise based client. It's perfect for small scripts or simple apps, it doesn't have a built-in cache and has no integrations for frontend frameworks.

Get it: npm install graphql-request

Sample usage:

1
2
3
4
5
6
7
8
import { request, GraphQLClient } from 'graphql-request'

// Run GraphQL queries/mutations using a static function
request(endpoint, query, variables).then(data => console.log(data))

// ... or create a GraphQL client instance to send requests
const client = new GraphQLClient(endpoint, { headers: {} })
client.request(query, variables).then(data => console.log(data))

GIF FTW!

graphql-request.gif

Suggest a module

Comments