Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

async fetch api call

async function getUserAsync(name) {
  try{
    let response = await fetch(`https://api.github.com/users/${name}`);
    return await response.json();
  }catch(err){
    console.error(err);
    // Handle errors here
  }
}
Source by dev.to #
 
PREVIOUS NEXT
Tagged: #async #fetch #api #call
ADD COMMENT
Topic
Name
9+1 =