aws-cdk-spa
v0.0.2
Published
Construct to deploy a single-page-application using S3 and Cloudfront.
Downloads
4
Readme
Single Page Application Construct for AWS-CDK
Installation
npm i aws-cdk-spa
Import into CDK app
import { SinglePageApplication } from 'aws-cdk-spa'
new SinglePageApplication(this, 'spa', {
applicationName: 'your-website-name',
websiteDirectory: 'public'
});
API Reference
Constructs
SinglePageApplication
Initializers
import { SinglePageApplication } from 'aws-cdk-spa'
new SinglePageApplication(scope: Construct, id: string, props: SinglePageApplicationProps)
| Name | Type | Description | | --- | --- | --- | | scope | constructs.Construct | No description. | | id | string | No description. | | props | SinglePageApplicationProps | No description. |
scope
Required
- Type: constructs.Construct
id
Required
- Type: string
props
Required
- Type: SinglePageApplicationProps
Methods
| Name | Description | | --- | --- | | toString | Returns a string representation of this construct. |
toString
public toString(): string
Returns a string representation of this construct.
Static Functions
| Name | Description |
| --- | --- |
| isConstruct | Checks if x
is a construct. |
~~isConstruct
~~
import { SinglePageApplication } from 'aws-cdk-spa'
SinglePageApplication.isConstruct(x: any)
Checks if x
is a construct.
x
Required
- Type: any
Any object.
Properties
| Name | Type | Description | | --- | --- | --- | | node | constructs.Node | The tree node. |
node
Required
public readonly node: Node;
- Type: constructs.Node
The tree node.
Structs
SinglePageApplicationProps
Initializer
import { SinglePageApplicationProps } from 'aws-cdk-spa'
const singlePageApplicationProps: SinglePageApplicationProps = { ... }
Properties
| Name | Type | Description | | --- | --- | --- | | applicationName | string | Chosen name for single-page application. | | websiteDirectory | string | Path to folder containing contents of single-page application. | | alternativeDomainNames | string[] | Alternative domain names on your certificate. | | domainName | string | Domain name for website. | | websiteErrorDocument | string | The name of the error document (e.g. "404.html") for the website. If the error document is not in the root folder, include the folder name followed by a slash and the error document name. (e.g. "errors/404.html"). | | websiteIndexDocument | string | The name of the index document (e.g. "index.html") for the website. |
applicationName
Required
public readonly applicationName: string;
- Type: string
Chosen name for single-page application.
websiteDirectory
Required
public readonly websiteDirectory: string;
- Type: string
Path to folder containing contents of single-page application.
alternativeDomainNames
Optional
public readonly alternativeDomainNames: string[];
- Type: string[]
- Default: No alternative names on certificate.
Alternative domain names on your certificate.
domainName
Optional
public readonly domainName: string;
- Type: string
- Default: A website will be created with the default generated name (e.g., d111111abcdef8.cloudfront.net)
Domain name for website.
websiteErrorDocument
Optional
public readonly websiteErrorDocument: string;
- Type: string
- Default: '404.html'
The name of the error document (e.g. "404.html") for the website. If the error document is not in the root folder, include the folder name followed by a slash and the error document name. (e.g. "errors/404.html").
websiteIndexDocument
Optional
public readonly websiteIndexDocument: string;
- Type: string
- Default: 'index.html'
The name of the index document (e.g. "index.html") for the website.