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/

Ok I figured out a thing and I can’t believe that it works… Server-side DB fetch in a @astro.build Server Island with 0 JS & no Svelte. Rendered in a prerendered mdx blogpost in a Astro content collection. import News from „@components/News.astro“; <News server:defer /> fubits.dev/notes/how-to...

fubits.devHow to Stay Up to Date in Svelte - Notes - @fubitsHow to Stay Up to Date in Svelte - @fubits' Notes on Web Development, Design & Data Visualization

0 reposts0 likes

No replies yet.