Have ideas to improve npm?Join in the discussion! »

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

1.6.0 • 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
});

Install

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

DownloadsWeekly Downloads

8,007

Version

1.6.0

License

MIT

Unpacked Size

33.9 kB

Total Files

8

Last publish

Collaborators

  • avatar
  • avatar