From 3662f389b1e569a849dbcfe752dbb8c1e0d4aea1 Mon Sep 17 00:00:00 2001 From: Peter Morgan Date: Fri, 5 Aug 2022 18:46:21 -0400 Subject: [PATCH] chore(docs): Replacing the quickstart gql query example (#374) --- README.md | 80 ++++++++++++++++++++++++++++++------------------------- 1 file changed, 43 insertions(+), 37 deletions(-) diff --git a/README.md b/README.md index ee0bf4fa3..3e0007ac7 100644 --- a/README.md +++ b/README.md @@ -7,38 +7,44 @@ Minimal GraphQL client supporting Node and browsers for scripts or simple apps -- [Features](#features) -- [Install](#install) -- [Quickstart](#quickstart) -- [Usage](#usage) -- [Node Version Support](#node-version-support) -- [Community](#community) - - [GraphQL Code Generator's GraphQL-Request TypeScript Plugin](#graphql-code-generators-graphql-request-typescript-plugin) -- [Examples](#examples) - - [Authentication via HTTP header](#authentication-via-http-header) - - [Incrementally setting headers](#incrementally-setting-headers) - - [Passing Headers in each request](#passing-headers-in-each-request) - - [Passing dynamic headers to the client](#passing-dynamic-headers-to-the-client) - - [Passing more options to `fetch`](#passing-more-options-to-fetch) +- [graphql-request](#graphql-request) + - [Features](#features) + - [Install](#install) + - [Quickstart](#quickstart) + - [Usage](#usage) + - [Node Version Support](#node-version-support) + - [Community](#community) + - [GraphQL Code Generator's GraphQL-Request TypeScript Plugin](#graphql-code-generators-graphql-request-typescript-plugin) + - [Examples](#examples) + - [Authentication via HTTP header](#authentication-via-http-header) + - [Incrementally setting headers](#incrementally-setting-headers) + - [Set endpoint](#set-endpoint) + - [passing-headers-in-each-request](#passing-headers-in-each-request) + - [Passing dynamic headers to the client](#passing-dynamic-headers-to-the-client) + - [Passing more options to `fetch`](#passing-more-options-to-fetch) - [Custom JSON serializer](#custom-json-serializer) - - [Using GraphQL Document variables](#using-graphql-document-variables) - - [Making a GET request](#making-a-get-request) - - [GraphQL Mutations](#graphql-mutations) - - [Error handling](#error-handling) - - [Using `require` instead of `import`](#using-require-instead-of-import) - - [Cookie support for `node`](#cookie-support-for-node) - - [Using a custom `fetch` method](#using-a-custom-fetch-method) - - [Receiving a raw response](#receiving-a-raw-response) - - [File Upload](#file-upload) - - [Browser](#browser) - - [Node](#node) - - [Batching](#batching) - - [Cancellation](#cancellation) - - [Middleware](#middleware) -- [FAQ](#faq) - - [Why do I have to install `graphql`?](#why-do-i-have-to-install-graphql) - - [Do I need to wrap my GraphQL documents inside the `gql` template exported by `graphql-request`?](#do-i-need-to-wrap-my-graphql-documents-inside-the-gql-template-exported-by-graphql-request) - - [What's the difference between `graphql-request`, Apollo and Relay?](#whats-the-difference-between-graphql-request-apollo-and-relay) + - [Using GraphQL Document variables](#using-graphql-document-variables) + - [Making a GET request](#making-a-get-request) + - [GraphQL Mutations](#graphql-mutations) + - [Error handling](#error-handling) + - [Using `require` instead of `import`](#using-require-instead-of-import) + - [Cookie support for `node`](#cookie-support-for-node) + - [Using a custom `fetch` method](#using-a-custom-fetch-method) + - [Receiving a raw response](#receiving-a-raw-response) + - [File Upload](#file-upload) + - [Browser](#browser) + - [Node](#node) + - [Batching](#batching) + - [Cancellation](#cancellation) + - [Middleware](#middleware) + - [ErrorPolicy](#errorpolicy) + - [None (default)](#none-default) + - [Ignore](#ignore) + - [All](#all) + - [FAQ](#faq) + - [Why do I have to install `graphql`?](#why-do-i-have-to-install-graphql) + - [Do I need to wrap my GraphQL documents inside the `gql` template exported by `graphql-request`?](#do-i-need-to-wrap-my-graphql-documents-inside-the-gql-template-exported-by-graphql-request) + - [What's the difference between `graphql-request`, Apollo and Relay?](#whats-the-difference-between-graphql-request-apollo-and-relay) @@ -64,16 +70,16 @@ import { request, gql } from 'graphql-request' const query = gql` { - Movie(title: "Inception") { - releaseDate - actors { - name - } + company { + ceo + } + roadster { + apoapsis_au } } ` -request('https://api.graph.cool/simple/v1/movies', query).then((data) => console.log(data)) +request('https://api.spacex.land/graphql/', query).then((data) => console.log(data)) ``` ## Usage