Fetching external API data with Astro

As well as using static data like Astro components and Markdown files, Astro allows you to pull in data from external APIs even if you're generating a static website.

Astro's Data Fetching documentation shows how to do this using the global fetch function. This is the same approach that I've been using to build a page of my open-source projects. I'm still working on it, but it fetches project information from both Drupal.org and GitHub and displays them on a page.

This is also makes Astro a good option to be used as a front-end for decoupled projects that use a separate back-end CMS like Drupal to store and manage the content which it fetches and uses when generating the site.

- Oliver

P.S. Do you want to learn about automated testing in Drupal? Take my free 10-day email course and get daily lessons straight to your inbox.

Was this useful?

Sign up here and get more like this delivered straight to your inbox every day.

About me

Picture of Oliver

I'm an Acquia-certified Drupal Triple Expert with 17 years of experience, an open-source software maintainer and Drupal core contributor, public speaker, live streamer, and host of the Beyond Blocks podcast.