graphql-crab
v0.0.4
Published
Humanized way to use chains operation for Graphql
Downloads
8
Readme
Humanized way to use chains operation for Graphql
Happy use Graphql without crab
Usage
ES5
const gql = require("graphql-crab");
ES6
import gql from "graphql-crab";
Browser
var gql = GraphqlCrab;
Query
const query = gql`
query($user: User, $page: Int, $perPage: Int) {
getUser(input: $user) {
userId
name
age
}
}
`
const payload = query.user({name: "Tim"}).page(1).perPage(10).toJSON()
payload
{
"query": `query($user: User, $page: Int, $perPage: Int) {
getUser(input: $user) {
userId
name
age
}
}`,
"variables": {
"user": {
"name": "Timothy",
},
"page": 1,
"perPage": 10,
},
}