Skip to content

Instantly share code, notes, and snippets.

@vanaf1979
Created February 8, 2026 13:54
Show Gist options
  • Select an option

  • Save vanaf1979/c41a24a293884b12c4cd97f8112749ec to your computer and use it in GitHub Desktop.

Select an option

Save vanaf1979/c41a24a293884b12c4cd97f8112749ec to your computer and use it in GitHub Desktop.
Fetch basic
// 1. Mark the function as async
const fetchStarTrekData = async () => {
// 2. The first 'await' waits for the initial response (headers)
const response = await fetch('https://api.since1979.dev/characters');
// 3. The second 'await' waits for the full body to be parsed as JSON
const data = await response.json();
// Now the data is ready to be used
console.log(data);
};
fetchStarTrekData();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment