astrobench · play with code
Step
10/11

Live from the API

Stop hardcoding. Use real data.

Stop hardcoding. Real astronauts have a real API.

 

Astro's secret: the frontmatter runs on the server when the page is built. That means you can await fetch(...) at the top — just like a Node script.

 

No "loading state" needed. By the time anyone visits, the data is baked into the HTML.

 

The cell below is already calling a (stubbed) /api/crew and rendering whatever it returns. Tweak it — change the headline, filter the list.

src/pages/index.astro — now live live

Same template, six cards, zero edits when Mission Control adds another astronaut. That's the whole pipeline.

— page 10 —
in the binder open binder →
saved a moment ago
progress 91%
earn +90 XP