Skip to content

delvedor/nanogql

This branch is 11 commits behind choojs/nanographql:master.

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Jul 31, 2017
bdc9ad7 · Jul 31, 2017

History

9 Commits
Jul 31, 2017
Jul 31, 2017
Jul 31, 2017
Jul 31, 2017
Jul 31, 2017
Jul 31, 2017
Jul 31, 2017

Repository files navigation

nanogql stability

npm version build status downloads js-standard-style

Tiny graphQL client library

Usage

var gql = require('nanogql')
var xhr = require('xhr')

var query = gql`
  query($number_of_repos:Int!) {
    viewer {
      name
      repositories(last: $number_of_repos) {
        nodes {
          name
        }
      }
    }
  }
`

var variables = { number_of_repos: 3 }
xhr('/query', { json: query(variables) }, function (err, res, body) {
  if (err) throw err
  if (body.errors) throw body.errors
  console.log(body.data)
})

API

query = gql(string)

Create a new graphql query function.

data = query([data])

Create a new query object that can be sent as application/json to a server.

License

MIT

About

Tiny graphQL client library

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%