1.0.0 • Published 6 years ago

graphql-compress v1.0.0

Weekly downloads
4
License
ISC
Repository
github
Last release
6 years ago

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.