| 1 | --- |
| 2 | import { env } from "cloudflare:workers"; |
| 3 | |
| 4 | // On-demand SSR: this page renders inside workerd (dev) / the Worker (live) |
| 5 | // and reads a Text binding server-side. |
| 6 | const value = (env as Record<string, unknown>).FIXTURE_VALUE ?? null; |
| 7 | --- |
| 8 | |
| 9 | <html lang="en"> |
| 10 | <head> |
| 11 | <meta charset="utf-8" /> |
| 12 | <meta name="viewport" content="width=device-width, initial-scale=1" /> |
| 13 | <title>Astro Fixture</title> |
| 14 | <style> |
| 15 | body { |
| 16 | font-family: system-ui, sans-serif; |
| 17 | margin: 2rem; |
| 18 | color: #1a1a1a; |
| 19 | background: #ffffff; |
| 20 | } |
| 21 | </style> |
| 22 | </head> |
| 23 | <body> |
| 24 | <h1>Astro Fixture</h1> |
| 25 | <p id="mode">on-demand</p> |
| 26 | <p id="binding">{value}</p> |
| 27 | <button id="counter" type="button">count is 0</button> |
| 28 | <p><a href="/about/">about</a></p> |
| 29 | <script> |
| 30 | // Client-side interactivity, bundled by Astro's client environment. |
| 31 | const button = document.getElementById("counter"); |
| 32 | let count = 0; |
| 33 | button?.addEventListener("click", () => { |
| 34 | count += 1; |
| 35 | button.textContent = `count is ${count}`; |
| 36 | }); |
| 37 | </script> |
| 38 | </body> |
| 39 | </html> |