Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

lambda-router-adapter

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

lambda-router-adapter

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

  • 1.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
7
increased by75%
Maintainers
1
Weekly downloads
 
Created
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

Package last updated on 01 Jan 2017

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