Preview:
const axios = require('axios');

async function fetchData(url) {
  try {
    const response = await axios.get(url); // Make an API call
    console.log('Data fetched successfully:', response.data); // Handle success
  } catch (error) {
    console.error('Error fetching data:', error.message); // Handle error
  }
}
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter