All Projects → kndt84 → Aws Api Gateway Client

kndt84 / Aws Api Gateway Client

Licence: mit
A client module of AWS API gateway both for Node.js and browsers

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Aws Api Gateway Client

Mangum
AWS Lambda & API Gateway support for ASGI
Stars: ✭ 475 (+299.16%)
Mutual labels:  api-gateway, aws
Workshop Donkeytracker
Workshop to build a serverless tracking application for your mobile device with an AWS backend
Stars: ✭ 27 (-77.31%)
Mutual labels:  api-gateway, aws
Aws Sam Cli
CLI tool to build, test, debug, and deploy Serverless applications using AWS SAM
Stars: ✭ 5,817 (+4788.24%)
Mutual labels:  api-gateway, aws
Claudia
Deploy Node.js projects to AWS Lambda and API Gateway easily
Stars: ✭ 3,690 (+3000.84%)
Mutual labels:  api-gateway, aws
Aws Power Tuner Ui
AWS Lambda Power Tuner UI is an open source project creating a deployable easy to use website built on a layered technology stack allowing you to optimize your Lambda functions for cost and/or performance in a data-driven way via an easy to use UI.
Stars: ✭ 52 (-56.3%)
Mutual labels:  api-gateway, aws
Shep
A framework for building JavaScript Applications with AWS API Gateway and Lambda
Stars: ✭ 376 (+215.97%)
Mutual labels:  api-gateway, aws
Lambda Proxy Router
A simple router for AWS Lambda Proxy Functions
Stars: ✭ 14 (-88.24%)
Mutual labels:  api-gateway, aws
Aws Mobile React Native Starter
AWS Mobile React Native Starter App https://aws.amazon.com/mobile
Stars: ✭ 2,247 (+1788.24%)
Mutual labels:  api-gateway, aws
Serverless Es Logs
A Serverless plugin to transport logs to ElasticSearch
Stars: ✭ 51 (-57.14%)
Mutual labels:  api-gateway, aws
Aws Serverless Java Container
A Java wrapper to run Spring, Jersey, Spark, and other apps inside AWS Lambda.
Stars: ✭ 1,054 (+785.71%)
Mutual labels:  api-gateway, aws
Serverless Aws Documentation
Serverless 1.0 plugin to add documentation and models to the serverless generated API Gateway
Stars: ✭ 299 (+151.26%)
Mutual labels:  api-gateway, aws
Aws Cli Cheatsheet
☁️ AWS CLI + JQ = Make life easier
Stars: ✭ 94 (-21.01%)
Mutual labels:  api-gateway, aws
Arc.codes
The Architect web site! 🌩
Stars: ✭ 271 (+127.73%)
Mutual labels:  api-gateway, aws
Aws Serverless Ecommerce Platform
Serverless Ecommerce Platform is a sample implementation of a serverless backend for an e-commerce website. This sample is not meant to be used as an e-commerce platform as-is, but as an inspiration on how to build event-driven serverless microservices on AWS.
Stars: ✭ 469 (+294.12%)
Mutual labels:  api-gateway, aws
Apilogs
Easy logging and debugging for Amazon API Gateway and AWS Lambda Serverless APIs
Stars: ✭ 216 (+81.51%)
Mutual labels:  api-gateway, aws
Aws Mobile React Sample
A React Starter App that displays how web developers can integrate their front end with AWS on the backend. The App interacts with AWS Cognito, API Gateway, Lambda and DynamoDB on the backend.
Stars: ✭ 650 (+446.22%)
Mutual labels:  api-gateway, aws
Serverless Aws Alias
Alias support for Serverless 1.x
Stars: ✭ 171 (+43.7%)
Mutual labels:  api-gateway, aws
Aws Lambda Fastify
Insipired by aws-serverless-express to work with Fastify with inject functionality.
Stars: ✭ 190 (+59.66%)
Mutual labels:  api-gateway, aws
Terraform Nextjs Plugin
A plugin to generate terraform configuration for Nextjs 8 and 9
Stars: ✭ 41 (-65.55%)
Mutual labels:  api-gateway, aws
Up
Up focuses on deploying "vanilla" HTTP servers so there's nothing new to learn, just develop with your favorite existing frameworks such as Express, Koa, Django, Golang net/http or others.
Stars: ✭ 8,439 (+6991.6%)
Mutual labels:  api-gateway, aws

dependencies Status Build Status npm

Overview

A module for AWS API gateway client based on auto-generated JavaScript SDK. This module can be used not only for Node.js but for front-end. In addition, it generalizes original SDK's endpoint specific methods.

Reference: https://docs.aws.amazon.com/apigateway/latest/developerguide/how-to-generate-sdk.html

Prerequisites

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.

Install

npm install aws-api-gateway-client

Use the SDK in your project

Require module

var apigClientFactory = require('aws-api-gateway-client').default;

Set invokeUrl to config and create a client. For authorization, additional information is required as explained below.

config = {invokeUrl:'https://xxxxx.execute-api.us-east-1.amazonaws.com'}
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 pathParams = {
    //This is where path request params go.
    userId: '1234',
};
// Template syntax follows url-template https://www.npmjs.com/package/url-template
var pathTemplate = '/users/{userID}/profile'
var method = 'GET';
var additionalParams = {
    //If there are query parameters or headers that need to be sent with the request you can add them here
    headers: {
        param0: '',
        param1: ''
    },
    queryParams: {
        param0: '',
        param1: ''
    }
};
var body = {
    //This is where you define the body of the request
};

apigClient.invokeApi(pathParams, pathTemplate, method, additionalParams, body)
    .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 appropriate CORS accept-* headers for each request.

var apigClient = apigClientFactory.newClient({
    invokeUrl:'https://xxxxx.execute-api.us-east-1.amazonaws.com', // REQUIRED

    region: 'eu-west-1',                                           // REQUIRED: The region where the API is deployed.

    accessKey: 'ACCESS_KEY',                                       // REQUIRED

    secretKey: 'SECRET_KEY',                                       // REQUIRED

    sessionToken: 'SESSION_TOKEN',                                 // OPTIONAL: If you are using temporary credentials
                                                                                you must include the session token.

    systemClockOffset: 0,                                          // OPTIONAL: An offset value in milliseconds to apply to signing time

    retries: 4,                                                    // OPTIONAL: Number of times to retry before failing. Uses axios-retry plugin.

    retryCondition: (err) => {                                     // OPTIONAL: Callback to further control if request should be retried.
      return err.response && err.response.status === 500;          //           Uses axios-retry plugin.
    },

    retryDelay: 100 || 'exponential' || (retryCount, error) => {   // OPTIONAL: Define delay (in ms) as a number, a callback, or
      return retryCount * 100                                      //           'exponential' to use the in-built exponential backoff
    },                                                             //           function. Uses axios-retry plugin. Default is no delay.

    shouldResetTimeout: false                                      // OPTIONAL: Defines if the timeout should be reset between retries. Unless
                                                                   //           `shouldResetTimeout` is set to `true`, the request timeout is
                                                                   //           interpreted as a global value, so it is not used for each retry,
                                                                   //           but for the whole request lifecycle.
});

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 appropriate CORS accept-* headers for each request.

var apigClient = apigClientFactory.newClient({
    invokeUrl:'https://xxxxx.execute-api.us-east-1.amazonaws.com', // REQUIRED
    apiKey: 'API_KEY', // REQUIRED
    region: 'eu-west-1' // REQUIRED
});
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].