2.6.2 • Published 5 years ago

thrive-next-aws-lambda v2.6.2

Weekly downloads
1
License
MIT
Repository
github
Last release
5 years ago

API Gateway Lambda Compat

Compat layer between next.js serverless page and API Gateway => Lambda Proxy Integration.

Lambda Proxy Integration event structure documentation can be found here.

Installation

npm install thrive-next-aws-lambda

Usage

const compat = require("thrive-next-aws-lambda");
const page = require(".next/serverless/pages/somePage.js");

// using callback

module.exports.render = (event, context, callback) => {
  compat(page)(event, context, callback);
};

// using async promise

module.exports.render = async (event, context) => {
  const responsePromise = compat(page)(event, context); // don't pass the callback parameter
  return responsePromise;
};