graphql-got

Convenience wrapper for got to interact with GraphQL

  • 所有者: kevva/graphql-got
  • 平台:
  • 許可證: MIT License
  • 分類:
  • 主題:
  • 喜歡:
    0
      比較:

Github星跟蹤圖

graphql-got Build Status

Convenience wrapper for got to interact with GraphQL

A lightweight alternative to apollo-client and relay.

Install

$ npm install graphql-got

Usage

const graphqlGot = require('graphql-got');

const query = `{
	unicorn(name: "Foo Bar") {
		id
		name
	}
}`;

graphqlGot('api.graphql.unicorn', {query}).then(response => {
	console.log(response.body);
	/*
	{
		unicorn: {
			id: 0,
			name: 'Foo Bar'
		}
	}
	*/
});

API

Same as got, but with some additional options below. URLs without protocol will be prepended with https://.

query

Required
Type: string

The query to send to GraphQL.

variables

Type: Object

Variables to be used in your query. Read more here.

operationName

Type: string

If your query contains multiple operations, this option is required to decide which operation to run.

token

Type: string

If defined, an Authorization header with bearer ${TOKEN} will be sent.

License

MIT © Kevin Mårtensson

主要指標

概覽
名稱與所有者kevva/graphql-got
主編程語言JavaScript
編程語言JavaScript (語言數: 1)
平台
許可證MIT License
所有者活动
創建於2017-09-12 17:35:13
推送於2018-03-14 19:41:13
最后一次提交2018-03-14 20:40:52
發布數3
最新版本名稱v0.1.2 (發布於 2018-03-14 20:40:52)
第一版名稱v0.1.0 (發布於 2017-09-12 19:48:45)
用户参与
星數104
關注者數3
派生數5
提交數10
已啟用問題?
問題數3
打開的問題數3
拉請求數2
打開的拉請求數0
關閉的拉請求數0
项目设置
已啟用Wiki?
已存檔?
是復刻?
已鎖定?
是鏡像?
是私有?