Skip to content

Instantly share code, notes, and snippets.

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

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

Select an option

Save vanaf1979/64fca527bb6b2c834ed384252981d8a4 to your computer and use it in GitHub Desktop.
Fetch Tnen
/ This works, but it's hard to follow as it grows
fetch('https://api.example.com/user/1')
.then(response => response.json())
.then(user => {
console.log('User found:', user.name);
return fetch(`https://api.example.com/posts?userId=${user.id}`);
})
.then(response => response.json())
.then(posts => {
console.log('Posts found:', posts.length);
})
.catch(error => {
console.error('Something went wrong:', error);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment