![Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility](https://cdn.sanity.io/images/cgdhsj6q/production/97774ea8c88cc8f4bed2766c31994ebc38116948-1664x1366.png?w=400&fit=max&auto=format)
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
aws-api-gateway-client
Advanced tools
A node.js module for AWS API gateway client. This module is based on auto-generated JavaScript SDK, however, it can be used as node.js module and generalizes endpoint specific functions.
Reference:
https://docs.aws.amazon.com/apigateway/latest/developerguide/how-to-generate-sdk.html
For the JavaScript SDK to work your APIs need to support CORS. The Amazon API Gateway developer guide explains how to setup CORS for an endpoint.
npm install aws-api-gateway-client
Require module
var apigClientFactory = require('aws-api-gateway-client')
Set config params and create a client. For autholization, additional information is required and explained below.
config = {invokeUrl:'https://xxxxx.execute-api.us-east-1.amazonaws.com/dev}
var apigClient = apigClientFactory.newClient(config);
Calls to an API take the form outlined below. Each API call returns a promise, that invokes either a success and failure callback
var params = {
//This is where any header, path, or querystring request params go. The key is the parameter named as defined in the API
userId: '1234',
};
var pathTemplate = '/users/{userID}/profile'
var body = {
//This is where you define the body of the request
};
var additionalParams = {
//If there are any unmodeled query parameters or headers that need to be sent with the request you can add them here
headers: {
param0: '',
param1: ''
},
queryParams: {
param0: '',
param1: ''
}
};
apigClient.invokeApi(params, pathTemplate, body, additionalParams)
.then(function(result){
//This is where you would put a success callback
}).catch( function(result){
//This is where you would put an error callback
});
#Using AWS IAM for authorization To initialize the SDK with AWS Credentials use the code below. Note, if you use credentials all requests to the API will be signed. This means you will have to set the appropiate CORS accept-* headers for each request.
var apigClient = apigClientFactory.newClient({
accessKey: 'ACCESS_KEY',
secretKey: 'SECRET_KEY',
sessionToken: 'SESSION_TOKEN', //OPTIONAL: If you are using temporary credentials you must include the session token
region: 'eu-west-1' // OPTIONAL: The region where the API is deployed, by default this parameter is set to us-east-1
});
#Using API Keys To use an API Key with the client SDK you can pass the key as a parameter to the Factory object. Note, if you use an apiKey it will be attached as the header 'x-api-key' to all requests to the API will be signed. This means you will have to set the appropiate CORS accept-* headers for each request.
var apigClient = apigClientFactory.newClient({
apiKey: 'API_KEY'
});
FAQs
A module for AWS API Gateway client
The npm package aws-api-gateway-client receives a total of 8,134 weekly downloads. As such, aws-api-gateway-client popularity was classified as popular.
We found that aws-api-gateway-client demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.