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

@orikami/micro-to-lambda

Package Overview
Dependencies
Maintainers
3
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@orikami/micro-to-lambda

Convert a [micro](https://github.com/zeit/micro) function to a lambda handler.

  • 1.3.0
  • latest
  • npm
  • Socket score

Version published
Maintainers
3
Created
Source

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

FAQs

Package last updated on 03 Jun 2019

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