57 lines
2.8 KiB
YAML
57 lines
2.8 KiB
YAML
uuid:
|
|
- value: d7924931-d38d-4c59-a987-6a10f48a18c9
|
|
langcode:
|
|
- value: en
|
|
type:
|
|
- target_id: daily_email
|
|
target_type: node_type
|
|
target_uuid: 8bde1f2f-eef9-4f2d-ae9c-96921f8193d7
|
|
revision_timestamp:
|
|
- value: '2025-05-11T09:00:48+00:00'
|
|
revision_uid:
|
|
- target_type: user
|
|
target_uuid: b8966985-d4b2-42a7-a319-2e94ccfbb849
|
|
revision_log: { }
|
|
status:
|
|
- value: true
|
|
uid:
|
|
- target_type: user
|
|
target_uuid: b8966985-d4b2-42a7-a319-2e94ccfbb849
|
|
title:
|
|
- value: |
|
|
Fetching external API data with Astro
|
|
created:
|
|
- value: '2023-02-08T00:00:00+00:00'
|
|
changed:
|
|
- value: '2025-05-11T09:00:48+00:00'
|
|
promote:
|
|
- value: false
|
|
sticky:
|
|
- value: false
|
|
default_langcode:
|
|
- value: true
|
|
revision_translation_affected:
|
|
- value: true
|
|
path:
|
|
- alias: /daily/2023/02/08/fetching-api-data-with-astro
|
|
langcode: en
|
|
body:
|
|
- value: |
|
|
<p>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.</p>
|
|
|
|
<p>Astro's <a href="https://docs.astro.build/en/guides/data-fetching">Data Fetching documentation</a> shows how to do this using the global <code>fetch</code> function. This is the same approach that I've been using to build <a href="https://github.com/opdavies/oliverdavies.uk/blob/39314de34ce22b14cf85f816e4469cc4d6fb822c/website/src/pages/open-source.astro">a page of my open-source projects</a>. I'm still working on it, but it fetches project information from both Drupal.org and GitHub and displays them on a page.</p>
|
|
|
|
<p>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.</p>
|
|
|
|
|
|
format: full_html
|
|
processed: |
|
|
<p>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.</p>
|
|
|
|
<p>Astro's <a href="https://docs.astro.build/en/guides/data-fetching">Data Fetching documentation</a> shows how to do this using the global <code>fetch</code> function. This is the same approach that I've been using to build <a href="https://github.com/opdavies/oliverdavies.uk/blob/39314de34ce22b14cf85f816e4469cc4d6fb822c/website/src/pages/open-source.astro">a page of my open-source projects</a>. I'm still working on it, but it fetches project information from both Drupal.org and GitHub and displays them on a page.</p>
|
|
|
|
<p>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.</p>
|
|
|
|
|
|
summary: null
|
|
field_daily_email_cta: { }
|