Post

This lil' "Astro SSR + DB" exercise obviously unlocks new powers for me.. To query and consume Cloudflare Workers D1 directly in an Astro route (SSR or not), all you need is: ``` const { env } = Astro.locals.runtime const { results } = await env.yourdb.prepare('SELECT * FROM Table').run() ``` 🤯🤯🤯

Ilja@fubits.dev

Fixed my @astro.build SSR + async Svelte + prerendering demo. Had to resort to a server endpoint. Good enough for now but I still want to figure out how to SSR a data-fetching index.astro on Cloudflare Workers. It would always only return [object Object] with prerender=false fubits.dev/how-much-is/

0 reposts5 likes