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

@aws-amplify/api

Package Overview
Dependencies
Maintainers
9
Versions
2161
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@aws-amplify/api

Api category of aws-amplify

  • 6.0.55-storage-browser-integrity.05ef3d8.0
  • Source
  • npm
  • Socket score

Version published
Maintainers
9
Created

What is @aws-amplify/api?

@aws-amplify/api is a part of the AWS Amplify library that provides a simple and powerful way to interact with AWS services such as AWS AppSync and REST APIs. It allows developers to easily integrate serverless backend services into their applications.

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

GraphQL API

This feature allows you to interact with GraphQL APIs, such as AWS AppSync. The code sample demonstrates how to query a list of todos from a GraphQL API.

const { API, graphqlOperation } = require('@aws-amplify/api');

const query = `query ListTodos {
  listTodos {
    items {
      id
      name
      description
    }
  }
}`;

API.graphql(graphqlOperation(query)).then(response => {
  console.log(response.data.listTodos.items);
}).catch(error => {
  console.error(error);
});

REST API

This feature allows you to interact with REST APIs. The code sample demonstrates how to make a GET request to a REST API endpoint.

const { API } = require('@aws-amplify/api');

const apiName = 'myApiName';
const path = '/items';
const myInit = { // OPTIONAL
  headers: {}, // OPTIONAL
  response: true // OPTIONAL (return the entire Axios response object instead of only response.data)
};

API.get(apiName, path, myInit).then(response => {
  console.log(response.data);
}).catch(error => {
  console.error(error);
});

API Configuration

This feature allows you to configure API endpoints. The code sample demonstrates how to configure a REST API endpoint with AWS Amplify.

const Amplify = require('@aws-amplify/core').default;
const config = {
  API: {
    endpoints: [
      {
        name: 'myApiName',
        endpoint: 'https://api.example.com',
        region: 'us-east-1'
      }
    ]
  }
};

Amplify.configure(config);

Other packages similar to @aws-amplify/api

FAQs

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