aws-cdk-spa
v0.0.2
Published
Construct to deploy a single-page-application using S3 and Cloudfront.
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. |
scopeRequired
- Type: constructs.Construct
idRequired
- Type: string
propsRequired
- Type: SinglePageApplicationProps
Methods
| Name | Description | | --- | --- | | toString | Returns a string representation of this construct. |
toString
public toString(): stringReturns 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.
xRequired
- Type: any
Any object.
Properties
| Name | Type | Description | | --- | --- | --- | | node | constructs.Node | The tree node. |
nodeRequired
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. |
applicationNameRequired
public readonly applicationName: string;- Type: string
Chosen name for single-page application.
websiteDirectoryRequired
public readonly websiteDirectory: string;- Type: string
Path to folder containing contents of single-page application.
alternativeDomainNamesOptional
public readonly alternativeDomainNames: string[];- Type: string[]
- Default: No alternative names on certificate.
Alternative domain names on your certificate.
domainNameOptional
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.
websiteErrorDocumentOptional
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").
websiteIndexDocumentOptional
public readonly websiteIndexDocument: string;- Type: string
- Default: 'index.html'
The name of the index document (e.g. "index.html") for the website.
