2.0.2 • Published 20 days ago

lombda v2.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
20 days ago

Lombda

This is a POC that lets you simulate an api gateway lambda proxy integration using an alternative server framework. For the moment only Express.js is supported.

The library transforms the incoming request object to the payload that api gateway sends to the lambda when configured as Lambda Proxy Integration, more details can be found here. It also supports lambda authorizer.

Setup

Lombda requires that you define the routes that your lambdas will be mapped to. To start you must install lombda package.

    npm i lombda

If you have environment variables

    npm i dotenv

and create an .env file with your variables

// lombda.js

const dotenv = require('dotenv');
const Lombda = require('lombda').default;

dotenv.config();

Lombda.express([
    {
        lambdaIndex: 'path/to/public/lambda/dist/index.js',
        lambdaHandler: 'handler',
        routeKey: 'POST /public-lambda',
    },
    {
        lambdaIndex: 'path/to/authorized/lambda/index.js',
        lambdaHandler: 'handler',
        routeKey: 'GET /authorized-lambda',
        authorizer: {
            lambdaIndex: 'path/to/authorizer/dist/index.js',
            lambdaHandler: 'handler',
        },
    },
], {
    basePath: __dirname,
    port: 3002,
});

To run it just execute

    node lombda.js
2.0.2

20 days ago

2.0.1

20 days ago

2.0.0

20 days ago

1.0.2

8 months ago

1.0.1

8 months ago

1.0.0

8 months ago