Skip to content
This repository has been archived by the owner on Aug 12, 2021. It is now read-only.

GraphQL

Willem Liu edited this page Mar 26, 2021 · 8 revisions

How to query

A simple POST request with the GraphQL Query as body is everything you need to query a GraphQL Server. Examples here:

https://graphql.org/graphql-js/graphql-clients/

Example:

fetch('/graphql', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'Accept': 'application/json',
  },
  body: JSON.stringify({query: "{ hello }"})
})
  .then(r => r.json())
  .then(data => console.log('data returned:', data));
data returned: Object { hello: "Hello world!" }

GraphQL config

https://graphql-config.com/ aims to standardize configuration for all GraphQL related tooling. It recommends having all GraphQL related configuration in a file at the root of the project named .graphqlrc. Furthermore it specifies the format of this configuration file. The official VSCode GraphQL plugin makes use of this configuration standard.

IDE GraphQL plugin

For autocomplete, syntax highlighting and inline query execution.

Prevent resource hacking/DDOS