Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

graphql-request-helper

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

graphql-request-helper

Helper Class of Graphql Client

  • 0.1.9
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

graphql-request-helper

Helper Class of Graphql Client

Getting Started

Installing

$ npm install graphql-request-helper

Example

import { GraphQLClient } from "graphql-request-helper";

Create Graphql Client

const graphQLClient = new GraphQLClient("http://localhost:3000/api/graphql");

Performing a Query request

const data = await graphQLClient.query({
  queryName: "getAnimals",
  fields: [
    "id",
    "name",
    "age",
    {
      name: "family",
      fields: ["id", "name"],
    },
  ],
  params: {
    age: 3,
  },
});

GraphQLClient receives the above fields and params and sends the following request

query{
    getAnimals(age: 3){
        id
        name
        family{
            id
            name
        }
    }
}

Performing a Mutation request

// In ready.

Catch an Error

// In ready.

Keywords

FAQs

Package last updated on 17 Jan 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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc