Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
@aws-amplify/api
Advanced tools
@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.
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);
Axios is a popular promise-based HTTP client for the browser and Node.js. It provides a simple API for making HTTP requests and is often used for interacting with REST APIs. Unlike @aws-amplify/api, it does not provide built-in support for AWS services or GraphQL APIs.
Apollo Client is a comprehensive state management library for JavaScript that enables you to manage both local and remote data with GraphQL. It is specifically designed for working with GraphQL APIs and offers more advanced features for caching and state management compared to @aws-amplify/api.
Fetch is a native JavaScript API for making HTTP requests. It is a low-level API that provides a more flexible and modern way to make network requests compared to older XMLHttpRequest. However, it lacks the higher-level abstractions and built-in AWS integrations provided by @aws-amplify/api.
INTERNAL USE ONLY
This package contains the AWS Amplify API category and is intended for internal use only. To integrate Amplify into your app, please use aws-amplify.
FAQs
Api category of aws-amplify
The npm package @aws-amplify/api receives a total of 481,108 weekly downloads. As such, @aws-amplify/api popularity was classified as popular.
We found that @aws-amplify/api demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 9 open source maintainers collaborating on the project.
Did you know?
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.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.