From f4cf059664b05cd54a3c3e9890e9466e12a3d2b9 Mon Sep 17 00:00:00 2001 From: Oliver Davies <oliver@oliverdavies.uk> Date: Sun, 12 Feb 2023 00:51:18 +0000 Subject: [PATCH] daily-email: add 2023-02-08 --- website/src/daily-emails/2023-02-08.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 website/src/daily-emails/2023-02-08.md diff --git a/website/src/daily-emails/2023-02-08.md b/website/src/daily-emails/2023-02-08.md new file mode 100644 index 00000000..36d3b199 --- /dev/null +++ b/website/src/daily-emails/2023-02-08.md @@ -0,0 +1,15 @@ +--- +title: > + Fetching external API data with Astro +pubDate: 2023-02-08 +permalink: > + archive/2023/02/08/fetching-api-data-with-astro +tags: + - 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](https://docs.astro.build/en/guides/data-fetching) 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](https://github.com/opdavies/oliverdavies.uk/blob/39314de34ce22b14cf85f816e4469cc4d6fb822c/website/src/pages/open-source.astro). 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.