7.0.8 • Published 1 month ago

@architect/asap v7.0.8

Weekly downloads
1,388
License
Apache-2.0
Repository
github
Last release
1 month ago

@architect/asap

Architect Static Asset Proxy (ASAP) - a helpful library for Lambda-based static asset delivery

GitHub CI status

Usage

Module

Call ASAP within your handler function manually like so:

let asap = require('@architect/asap')

// All config is optional!
module.exports = asap({
  // Alias assets to different filenames
  alias: {
    '/an-asset.jpg': '/a-different-filename.jpg',
    '/a-path': '/a-different-path',
  },
  // Pass your own fingerprinted static asset manifest (defaults to Arc-generated static.json)
  assets: { 'some-file.gif': 'some-file-a1b2c3.gif' },
  // Set a custom bucket configuration (defaults to Arc-generated buckets)
  bucket: {
    staging: 'staging-bucket-name',
    production: 'production-bucket-name',
    folder: 'some-bucket-subfolder',
  },
  // Override the content-aware cache-control header
  cacheControl: 'max-age=0',
  // Manually set response headers
  headers: { 'some-header': 'ok=true' },
  // Return null if asset is not found (defaults to `false`)
  passthru: true,
  // Engage SPA mode (defaults to `false`)
  spa: false,
})

Lambda handler

Use ASAP as the handler for your Lambda! If you're using Architect, this is done automatically for you when you don't define a root handler for your @http pragma.

If using ASAP with non-Architect projects, just point your Lambda's source directory to src/, and make sure you set the following two env vars:

  • ARC_ENV: staging or production
  • ARC_STATIC_BUCKET: the S3 bucket name where your assets are stored
7.0.8

1 month ago

7.0.7

3 months ago

7.0.5

3 months ago

7.0.4

3 months ago

7.0.3-RC.0

3 months ago

7.0.3

3 months ago

7.0.0

3 months ago

7.0.2

3 months ago

7.0.1

3 months ago

7.0.0-RC.2

3 months ago

7.0.0-RC.1

3 months ago

6.0.6

3 months ago

6.0.5

4 months ago

7.0.0-RC.0

4 months ago

6.1.0-RC.0

5 months ago

6.0.4

5 months ago

6.0.1

10 months ago

6.0.3

9 months ago

6.0.2

9 months ago

6.0.0

11 months ago

5.1.1

1 year ago

5.0.3-RC.1

1 year ago

5.0.2

2 years ago

5.1.0

1 year ago

5.0.3-RC.0

1 year ago

5.0.1

2 years ago

5.0.0

2 years ago

5.0.0-RC.0

2 years ago

4.1.0

3 years ago

4.0.1-RC.2

3 years ago

4.0.1-RC.1

3 years ago

4.0.1-RC.0

3 years ago

4.0.0-RC.0

3 years ago

4.0.0

3 years ago

3.13.8

3 years ago

3.13.8-RC0

3 years ago