npm.io
1.0.0 • Published 8 years ago

graphql-compress

Licence
ISC
Version
1.0.0
Deps
0
Size
5 kB
Vulns
0
Weekly
0
Stars
1

graphql-compress

Small regex-based compressor to be used before sending a graphql query over the wire.

Influenced by graphql-query-compress, which takes a more complex, lexer-based approach.

Installation

$ npm install graphql-compress

Usage

const graphQLCompress = require('graphql-compress');

const query = `
{
  allSpecies {
    edges {
      node {
        name
      }
    }
  }
}
`;

const uri = `http://graphql.org/swapi-graphql/?query=${graphQLCompress(query)}`;

// Send request to uri using fetch or the http library of your choice.

Keywords