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?
已存档?
是复刻?
已锁定?
是镜像?
是私有?