Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[next] add Guide for data fetching #341

Open
daKmoR opened this issue Mar 24, 2022 · 0 comments
Open

[next] add Guide for data fetching #341

daKmoR opened this issue Mar 24, 2022 · 0 comments
Labels
documentation Improvements or additions to documentation

Comments

@daKmoR
Copy link
Member

daKmoR commented Mar 24, 2022

potentially with an example like this

import eleventyFetch from '@11ty/eleventy-fetch';

const films = await eleventyFetch('https://swapi.dev/api/films/', {
  duration: '1d',
  type: 'json',
});

export default () => html`
  <h1>Star Wars</h1>

  <h2>Films:</h2>
  <ul>
    ${films.results.map(film => html`<li>${film.title} (${film.release_date})</li>`)}
  </ul>
`;
@daKmoR daKmoR added the documentation Improvements or additions to documentation label Aug 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

1 participant