Socket
Socket
Sign inDemoInstall

lambda-router-adapter

Package Overview
Dependencies
23
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    lambda-router-adapter

Adapts Lambda Router Requests and Responses to NodeJS HTTP Request and Responses


Version published
Weekly downloads
5
decreased by-50%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

lambda-router-adapter

Adapts Lambda Router Requests and Responses to NodeJS HTTP Request and Responses. This is a utility library for implementing AWS Lambda functions that receive events from the github.com/jamiemccrindle/lambda-router project.

Usage

Express 4.x

lambda-router-adapter has built in support for express 4.x. Use the newExpressHandler method to convert an express app into a lambda handler.

var express = require('express');
var adapter =require('lambda-router-adapter');
var app = express();

app.get('/', function(req, res) {
    res.send('Hello World');
});

module.exports.handler = adapter.newExpressHandler(app);

Generic

convertRequest

Convert a lambda event into a LambdaHttpRequest, which has the same interface as a NodeJS http request.

The lambda event must have the following fields:

  • url
  • method

The lambda event could have the following fields:

  • body
  • headers
newResponse

Create a new LambdaHttpResponse which has the same interface as a NodeJS http response.

convertResponse

Serialise the LambdaHttpResponse into an object that can be sent as a lambda response.

The response will have the following fields:

  • statusCode
  • statusMessage
  • headers
  • body or bodyBase64

Keywords

FAQs

Last updated on 01 Jan 2017

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc