@sls-next-n5/next-aws-cloudfront
TypeScript icon, indicating that this package has built-in type declarations

3.8.0-alpha.2 • Public • Published

Next AWS CloudFront

Compat layer between next.js serverless page and CloudFront => Lambda@Edge.

Lambda@Edge event structure documentation can be found here.

Installation

npm install next-aws-cloudfront

Usage

const cloudFrontCompat = require("next-aws-cloudfront");
const page = require(".next/serverless/pages/somePage.js");

module.exports.render = async (event, context) => {
  const { req, res, responsePromise } = cloudFrontCompat(event.Records[0].cf);
  page.render(req, res);
  return responsePromise;
};

Options

Gzip compression

const { req, res, responsePromise } = cloudFrontCompat(event.Records[0].cf, {
  enableHTTPCompression: true // false by default
});

Package Sidebar

Install

npm i @sls-next-n5/next-aws-cloudfront

Weekly Downloads

0

Version

3.8.0-alpha.2

License

MIT

Unpacked Size

40.7 kB

Total Files

9

Last publish

Collaborators

  • thomasvanleynseele
  • danfritz