1.3.0 • Published 6 years ago

@orikami/micro-to-lambda v1.3.0

Weekly downloads
-
License
MIT
Repository
-
Last release
6 years ago

micro-to-lambda

Convert a micro function to a lambda handler.

Install

npm install --save @orikami/micro-to-lambda

Usage

Given a micro function in index.js

module.exports = (req,res) => ({ time: new Date() })

Convert it to a lambda function in handler.js:

var microToLambda = require('micro-to-lambda');
var index = require('./index');
module.exports.time = microToLambda(index);

By default, the lambda will terminate the process after every request. If you want to keep the process alive, use:

microToLambda(handler, { keepAlive: true, iPromiseToCloseDatabaseConnections: true })

As you can see, you have to promise to close all database connections (to MongoDB). Otherwise, the autoscaling of lambda can cause trouble for the connection limit of the database.

require("async-to-gen/register");

Changelog

1.2.1 - Remove process.exit() to fix error. 1.1.1 - Close AWS Lambda after every process. (HAS ERRORS) 0.0.01 - Initial release

1.3.0

6 years ago

1.2.1

7 years ago

1.2.0

7 years ago

1.1.1

7 years ago

1.1.0

7 years ago

1.1.0-rc1

7 years ago

0.0.1

7 years ago