Source Directory

The src/ directory is where you put all your Layer0 components which can then be imported inside your routes.js file.

The directory contains the following files:

  • browser.ts : This is the entry point for the main.js javascript bundle which is added to the window.
  • cache.ts : This is where the caching rules are defined for both Layer0 (edge) and the browser.
  • routes.ts : This is where the routes to be cached and prefetched are defined, as well as what to pass through without modification and what to serve up as static content.
  • service-worker.ts : Is run on the browser. Is used to prefetch and serve content directly through browser.
  • shoppingFlowRouteHandler.ts : Is run on Layer0 if referenced in routes.ts. It’s where the caching rules get implemented, as well as where the modifications to be made to the requests and/or responses to support caching of dynamic content are defined.
  • transform.ts : Is run on Layer0 Serverless, AWS Lambda. Is used to transform responses (and requests).
Edit this page on GitHub Updated at Tue, Jun 21, 2022