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

@aws-amplify/api-graphql

Package Overview
Dependencies
Maintainers
0
Versions
1713
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@aws-amplify/api-graphql

Api-graphql category of aws-amplify

  • 4.5.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
578K
decreased by-19.26%
Maintainers
0
Weekly downloads
 
Created

What is @aws-amplify/api-graphql?

@aws-amplify/api-graphql is a package that allows developers to interact with GraphQL APIs in a seamless manner. It is part of the AWS Amplify framework, which provides a set of tools and services to build secure, scalable mobile and web applications. This package specifically focuses on enabling GraphQL operations such as queries, mutations, and subscriptions.

What are @aws-amplify/api-graphql's main functionalities?

GraphQL Queries

This feature allows you to perform GraphQL queries to fetch data from your API. The code sample demonstrates how to define a query to list todos and execute it using the API.graphql method.

const query = `query ListTodos { listTodos { items { id name description } } }`;
API.graphql(graphqlOperation(query)).then(response => {
  console.log(response.data.listTodos.items);
});

GraphQL Mutations

This feature allows you to perform GraphQL mutations to modify data in your API. The code sample shows how to define a mutation to create a new todo item and execute it using the API.graphql method.

const mutation = `mutation CreateTodo { createTodo(input: { name: "New Todo", description: "This is a new todo" }) { id name description } }`;
API.graphql(graphqlOperation(mutation)).then(response => {
  console.log(response.data.createTodo);
});

GraphQL Subscriptions

This feature allows you to subscribe to real-time updates from your GraphQL API. The code sample demonstrates how to define a subscription to listen for new todo items being created and handle the incoming data.

const subscription = `subscription OnCreateTodo { onCreateTodo { id name description } }`;
const subscriptionClient = API.graphql(graphqlOperation(subscription)).subscribe({
  next: (response) => {
    console.log(response.value.data.onCreateTodo);
  }
});

Other packages similar to @aws-amplify/api-graphql

FAQs

Package last updated on 31 Oct 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