![require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages](https://cdn.sanity.io/images/cgdhsj6q/production/be8ab80c8efa5907bc341c6fefe9aa20d239d890-1600x1097.png?w=400&fit=max&auto=format)
Security News
require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
@educational-technology-collective/etc_http_aws_api_gateway_wrapper
Advanced tools
## Description This package offers a Wrapper that can be used to log messages to specially configured AWS Gateway APIs. Instantiation of a Wrapper involves providing 3 required arguments: the URL to the AWS API Gateway, the name of the S3 Bucket, and the
This package offers a Wrapper that can be used to log messages to specially configured AWS Gateway APIs. Instantiation of a Wrapper involves providing 3 required arguments: the URL to the AWS API Gateway, the name of the S3 Bucket, and the path that messages should be saved to in the S3 bucket.
The Wrapper logs errors to console.error by default.
The Wrapper has two methods: AWSAPIGatewayWrapper#request
and AWSAPIGatewayWrapper#requestAsync
.
AWSAPIGatewayWrapper#request
will handle erros by logging the error to the errorHandler
specified in the constructor. It will then continue to retry the request after the number seconds specified by the constructor's retry
argument.
AWSAPIGatewayWrapper#requestAsync
will return a Promise that will resolve with a Response
object or reject with an error. This method does not automatically retry the request if an error happens. It gives you more control over error handling.
Each logged S3 object is named by the AWS Gateway server using a combination of timestamp and UUID. E.g., 1625155259384-9a47660f-3ffe-469d-b1d5-2de875a6a022
. In this example, 1625155259384
is the timestamp and 9a47660f-3ffe-469d-b1d5-2de875a6a022
is the UUID.
First change directory into the base directory of your repository.
Install the dependency and add it to your package.json file.
npm add @educational-technology-collective/etc_http_aws_api_gateway_wrapper
Import the Wrapper.
import { AWSAPIGatewayWrapper } from "@educational-technology-collective/etc_http_aws_api_gateway_wrapper"
constructor
AWSAPIGatewayWrapper#requestAsync(data)
AWSAPIGatewayWrapper#request(data)
Example:
let awsAPIGatewayWrapper: AWSAPIGatewayWrapper = new AWSAPIGatewayWrapper(
{
url: "https://exmaple.com",
bucket: "the-name-of-the-bucket",
path: "the-name-of-the-path",
retry: 1000,
errorHandler: console.error
});
This is an example of making a synchronous
HTTP request to an S3 bucket.
import { AWSAPIGatewayWrapper } from "@educational-technology-collective/etc_http_aws_api_gateway_wrapper";
let timestamp: number = Date.now();
let awsAPIGatewayWrapper: AWSAPIGatewayWrapper = new AWSAPIGatewayWrapper(
{
url: "https://exmaple.com",
bucket: "the-name-of-the-bucket",
path: "the-name-of-the-path",
retry: 1000,
errorHandler: console.error
});
awsAPIGatewayWrapper.request(["This request was made by AWSAPIGatewayWrapper#request.", timestamp]);
This is an example of making a asynchronous
HTTP request to an S3 bucket.
import { AWSAPIGatewayWrapper } from "@educational-technology-collective/etc_http_aws_api_gateway_wrapper";
let awsAPIGatewayWrapper: AWSAPIGatewayWrapper = new AWSAPIGatewayWrapper(
{
url: "https://exmaple.com",
bucket: "the-name-of-the-bucket",
path: "the-name-of-the-path",
retry: 1000,
errorHandler: console.error
});
(async function () {
try {
let timestamp: number = Date.now();
await awsAPIGatewayWrapper.requestAsync(["This request was made by AWSAPIGatewayWrapper#requestAsync.", timestamp]);
}
catch (e) {
console.error(e);
}
})();
FAQs
## Description This package offers a Wrapper that can be used to log messages to specially configured AWS Gateway APIs. Instantiation of a Wrapper involves providing 3 required arguments: the URL for the AWS API Gateway, the name of the S3 Bucket, and th
We found that @educational-technology-collective/etc_http_aws_api_gateway_wrapper demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 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
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
Security News
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.