New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@grafoo/http-transport

Package Overview
Dependencies
Maintainers
1
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@grafoo/http-transport

grafoo client standard transport

latest
Source
npmnpm
Version
1.4.2
Version published
Maintainers
1
Created
Source

@grafoo/http-transport

A Simple HTTP Client for GraphQL Servers

build coverage npm downloads size code style: prettier mantained with: lerna slack

Install

$ npm i @grafoo/http-transport

Usage

@grafoo/http-transport default export is a factory that accepts as arguments uri and fetchOptions (that can be an object or a function):

import createTransport from "@grafoo/http-transport";

const request = createTransport("http://some.graphql.api", () => ({
  headers: {
    authorization: storage.getItem("authorization")
  }
}));

const USER_QUERY = `
  query($id: ID!) {
    user(id: $id) {
      name
    }
  }
`;

const variables = { id: 123 };

request(USER_QUERY, variables).then(({ data }) => {
  console.log(data.user);
});

Warning

As this package uses fetch and Object.assign under the hood, make sure to install the proper polyfills if you want to use it in your project.

LICENSE

MIT

Keywords

graphql

FAQs

Package last updated on 25 Oct 2021

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