SsrSite
Source:
src/AWS/Website/SsrSite.ts
A server-rendered website behind CloudFront.
SsrSite serves a dynamic origin behind CloudFront and can optionally split
immutable static assets into a private S3 bucket origin.
Creating SSR Sites
Section titled “Creating SSR Sites”Lambda URL Origin
const site = yield* SsrSite("App", { server: { type: "lambda", function: appFunction, },});SSR With Static Assets
const site = yield* SsrSite("App", { server: { type: "lambda", function: appFunction, }, assets: { sourcePath: "./dist/client", },});Custom Domains
Section titled “Custom Domains”const site = yield* SsrSite("App", { server: { type: "ecs", service: webService, }, domain: { name: "app.example.com", hostedZoneId: zone.hostedZoneId, },});Router Composition
Section titled “Router Composition”// Skip the standalone distribution and register the returned// routeTargets on an AWS.Website.Router instead.const site = yield* SsrSite("App", { server: { type: "lambda", function: appFunction, }, cdn: false,});
const router = yield* AWS.Website.Router("WebsiteRouter", { routes: { "/*": site.routeTargets.server, },});