New:Introducing Socket Scanning for VS Code Marketplace Extensions.Learn more →
Get Started

ts-lambda-handler

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ts-lambda-handler

Typescript library for writing AWS Lambda functions.

Source
npmnpm
Version
0.0.3
Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

LamdaHandler

LambdaHandler is a library designed to make it easy to write AWS Lambda function in typescript. It tries to abstract the more mondane logic related to implementing a AWS Lambda function.

The library caters primarely to handling AWS API Gateaway request using the Lambda Proxy integration.

The LambdaHandler library is designed to write reusable object oriented code for Lambda.

Key features

  • Abstract the AWS API Gateway Event and AWS Lambda Proxy Callback via Request and Response objects.
  • Provide classes for standard HTTP errors.
  • Provide a handlers for typical task like accessing a Dynamo table via a RESTFull API, Queing requests in an SQS Queue or Proxying a request to a different server.

Installation

npm install --save ts-lambda-handler

Show me some examples

Hello World

import * as LambdaHandler from 'lambda-handler';

class DivisionHandler extends LambdaHandler.Handlers.AbstractHandler {

    public process(request:LambdaHandler.Request, response:LambdaHandler.Response): Promise<void> {
        response.setBody('hello world').addHeader('content-type', 'text/plain').send();
        return Promise.resolve();
    }

}

const handlerObj = new DivisionHandler();
export let handler = handlerObj.handle;

Keywords

typescript

FAQs

Package last updated on 19 May 2017

Related posts