@ez4/distribution
v0.41.0
Published
EZ4: Components to build CDN services
Readme
EZ4: Distribution
It uses the power of reflection to provide a contact that determines how to build and connect distribution components.
Getting started
Install
npm install @ez4/distribution @ez4/aws-cloudfront -DCreate distribution
// file: site.ts
import type { Environment } from '@ez4/common';
import type { Cdn } from '@ez4/distribution';
// MySite declaration
export declare class MySite extends Cdn.Service {
defaultIndex: 'index.html';
defaultOrigin: Cdn.UseDefaultOrigin<{
bucket: Environment.Service<MySiteBucket>;
}>;
certificate: Cdn.UseCertificate<{
domain: '*.my-site.tld';
}>;
aliases: ['home.my-site.tld'];
fallbacks: [
Cdn.UseFallback<{
code: 404;
location: '/index.html';
}>
];
}Distribution properties
Service
| Name | Type | Description | | ------------- | ---------------------- | ------------------------------------------------------- | | origins | Cdn.UseOrigin<> | Distribution origins. | | defaultOrigin | Cdn.UseDefaultOrigin<> | Default origin for the distribution results. | | certificate | Cdn.UseCertificate<> | Custom certificate associated to the distribution. | | defaultIndex | string | Default index file name. | | aliases | string | List of CNAME aliases for the distribution. | | fallbacks | string | Distribution fallbacks. | | disabled | boolean | Determines whether or not the distribution is disabled. |
Use type helpers for
origins,defaultOriginandcertificateproperties.
Examples
Providers
License
MIT License
