Socket
Socket
Sign inDemoInstall

@aws-sdk/client-api-gateway

Package Overview
Dependencies
Maintainers
5
Versions
398
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@aws-sdk/client-api-gateway

AWS SDK for JavaScript Api Gateway Client for Node.js, Browser and React Native


Version published
Weekly downloads
693K
decreased by-2.67%
Maintainers
5
Weekly downloads
 
Created

What is @aws-sdk/client-api-gateway?

@aws-sdk/client-api-gateway is a part of the AWS SDK for JavaScript, which allows developers to interact with the Amazon API Gateway service. This package provides a set of tools to create, deploy, and manage APIs at any scale.

What are @aws-sdk/client-api-gateway's main functionalities?

Create a new API

This feature allows you to create a new REST API in Amazon API Gateway. The code sample demonstrates how to create a new API named 'MyAPI' using the APIGatewayClient and CreateRestApiCommand.

const { APIGatewayClient, CreateRestApiCommand } = require('@aws-sdk/client-api-gateway');

const client = new APIGatewayClient({ region: 'us-west-2' });
const command = new CreateRestApiCommand({ name: 'MyAPI' });

client.send(command).then(
  (data) => console.log(data),
  (error) => console.error(error)
);

Deploy an API

This feature allows you to deploy an API to a specific stage. The code sample demonstrates how to deploy an API to the 'prod' stage using the APIGatewayClient and CreateDeploymentCommand.

const { APIGatewayClient, CreateDeploymentCommand } = require('@aws-sdk/client-api-gateway');

const client = new APIGatewayClient({ region: 'us-west-2' });
const command = new CreateDeploymentCommand({ restApiId: 'your-rest-api-id', stageName: 'prod' });

client.send(command).then(
  (data) => console.log(data),
  (error) => console.error(error)
);

Create a resource

This feature allows you to create a new resource under an existing API. The code sample demonstrates how to create a new resource named 'myresource' under a specified parent resource using the APIGatewayClient and CreateResourceCommand.

const { APIGatewayClient, CreateResourceCommand } = require('@aws-sdk/client-api-gateway');

const client = new APIGatewayClient({ region: 'us-west-2' });
const command = new CreateResourceCommand({ restApiId: 'your-rest-api-id', parentId: 'your-parent-id', pathPart: 'myresource' });

client.send(command).then(
  (data) => console.log(data),
  (error) => console.error(error)
);

Create a method

This feature allows you to create a new method for a resource. The code sample demonstrates how to create a GET method with no authorization for a specified resource using the APIGatewayClient and PutMethodCommand.

const { APIGatewayClient, PutMethodCommand } = require('@aws-sdk/client-api-gateway');

const client = new APIGatewayClient({ region: 'us-west-2' });
const command = new PutMethodCommand({ restApiId: 'your-rest-api-id', resourceId: 'your-resource-id', httpMethod: 'GET', authorizationType: 'NONE' });

client.send(command).then(
  (data) => console.log(data),
  (error) => console.error(error)
);

Other packages similar to @aws-sdk/client-api-gateway

FAQs

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