- Dynamic HTML comes from individual bundles compiled for every server rendered page.
- The contents of each
astro
template determine if a page is static or dynamic:- Static pages output complete HTML documents at build time
- Dynamic pages output ES Modules that are run on a server
- Each bundle should be and ES Module that exports a standard interface with methods for creating
- HTML payloads
- an entire document for full page requests
- a partial document for incremental updates
- a JSON payload with the props for the template
- HTML payloads
- Individual bundles makes for an ideal target for serverless functions and makes a path for hybrid CDN + SSR deployments
- The contents of each
- Backend architecture boils down to 3 layers:
- An edge service that handles routing. Some routes return cached static content, other routes trigger serverless functions that return dynamic html.
- Static file storage / CDN with good cache policies
- Serverless functions for:
- HTML payloads for "full page" requests
- JSON responses for hydrating client-side rendering
- How
- generate a Resource Map of bundles to routes as an intermediate step
- from the Resource Map , create build files targeting specific cloud hosts, so Astro is both framework and backend agnostic.
- dev server works similarly but with a virtual file system and incremental compilation
Last active
October 4, 2021 17:26
-
-
Save wookiehangover/c65065b27a788b8f478307f34d757c26 to your computer and use it in GitHub Desktop.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment