1.0.11 • Published 7 years ago

guel v1.0.11

Weekly downloads
1
License
ISC
Repository
github
Last release
7 years ago

Install

yarn add guel

How To

var client = require('guel')({
  url: 'http://your-host/graphql',
  headers: {
    Authorization: 'Bearer ' + token
  }
})

Polyfills

isomorphic-fetch and Promise

var variables = {
query: "Search Query",
limit: 100,
from: 200
}

client
.query(
  `
query search ($query: String, $from: Int, $limit: Int) {
  search(query: $query, from: $from, limit: $limit) {
    took,
    totalHits,
    hits {
      name
    }
  }
}`,
  variables,
  function(req, res) {
    if (res.status === 401) {
      throw new Error("Not authorized")
    }
  }
)
.then(function(body) {
  console.log(body)
})
.catch(function(err) {
  console.log(err.message)
})
1.0.11

7 years ago

1.0.10

7 years ago

1.0.9

7 years ago

1.0.8

7 years ago

1.0.7

7 years ago

1.0.6

7 years ago

1.0.5

7 years ago

1.0.4

7 years ago