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

@graphql-tools/executor-http

Package Overview
Dependencies
Maintainers
3
Versions
325
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@graphql-tools/executor-http

A set of utils for faster development of GraphQL tools

  • 1.1.9-alpha-20241113133112-c3b5386bf492df898791af304c8d9da1ea27bbb1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3.1M
increased by6.18%
Maintainers
3
Weekly downloads
 
Created

What is @graphql-tools/executor-http?

The @graphql-tools/executor-http package is designed to facilitate the execution of GraphQL queries over HTTP. It provides a simple and efficient way to interact with GraphQL APIs by sending queries and mutations directly through HTTP requests. This package is part of the larger GraphQL Tools ecosystem, which offers various utilities for building and managing GraphQL servers and clients.

What are @graphql-tools/executor-http's main functionalities?

Executing GraphQL queries over HTTP

This feature allows developers to execute GraphQL queries by sending them to a specified GraphQL endpoint. The executor handles the HTTP request and response, simplifying the process of querying a GraphQL server.

const { ExecutorHttp } = require('@graphql-tools/executor-http');

const executor = new ExecutorHttp({ uri: 'https://your-graphql-endpoint.com/graphql' });

const query = `{ users { id name } }`;

executor.execute({ document: query }).then(result => {
  console.log(result);
}).catch(error => {
  console.error(error);
});

Handling GraphQL mutations

This feature supports the execution of GraphQL mutations, allowing for data manipulation operations such as adding, updating, or deleting data. The executor sends the mutation along with any necessary variables to the GraphQL server.

const { ExecutorHttp } = require('@graphql-tools/executor-http');

const executor = new ExecutorHttp({ uri: 'https://your-graphql-endpoint.com/graphql' });

const mutation = `mutation AddUser($name: String!) { addUser(name: $name) { id } }`;

const variables = { name: 'New User' };

executor.execute({ document: mutation, variables }).then(result => {
  console.log(result);
}).catch(error => {
  console.error(error);
});

Other packages similar to @graphql-tools/executor-http

FAQs

Package last updated on 13 Nov 2024

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