0.4.4 • Published 1 year ago

remix-lambda-at-edge v0.4.4

Weekly downloads
-
License
-
Repository
github
Last release
1 year ago

Remix Adapter for CloudFront Lambda@Edge

Package was originally forked from https://github.com/ajhaining/remix-lambda-at-edge but deployed to npm as its own package after failing to get in contact with the original author

This adapter transforms CloudFront Origin Request Events into Web Fetch API Request and Response objects using the adapter convention set out in the Remix Docs.

Usage

import { createRequestHandler } from "remix-lambda-at-edge";

export const handler = createRequestHandler({
  getBuild: () => require("./build"),
  getLoadContext: event => {
    // access to raw CloudFront event to provide context to loaders
  },
  // mode?: string; development or production, defaulted to NODE_ENV 
  // originPaths?: (string | RegExp)[]; set of paths returned to cloudfront to lookup in S3 instead
  // onError?: (e: Error) => void; method called if remix fails to handle the request for any reason
  // debug?: boolean; add extra logging to cloudfront, defaults to false
});