All Projects → choojs → Nanographql

choojs / Nanographql

Licence: mit
Tiny graphQL client library

Programming Languages

javascript
184084 projects - #8 most used programming language

nanographql stability

npm version build status downloads js-standard-style

Tiny graphQL client library. Does everything you need with GraphQL 15 lines of code.

Usage

var gql = require('nanographql')

var query = gql`
  query($name: String!) {
    movie (name: $name) {
      releaseDate
    }
  }
`

try {
  var res = await fetch('/query', {
    body: query({ name: 'Back to the Future' }),
    method: 'POST'
  })
  var json = res.json()
  console.log(json)
} catch (err) {
  console.error(err)
}

API

query = gql(string)

Create a new graphql query function.

json = query([data])

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

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].