Socket
Book a DemoInstallSign in
Socket

nanogql

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nanogql

Tiny graphQL client library

latest
Source
npmnpm
Version
1.1.0
Version published
Maintainers
1
Created
Source

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

Keywords

graphql

FAQs

Package last updated on 03 Sep 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts