0

I'm trying to start some node.js for a react app but I can't seem to get an axios request to return its reponse. When I run this script below it logs 'undefined'

function getreq() {
  axios.get('https://example.com')
  .then(res => {
    return(res.data)

  })
  .catch(error => {
    console.error(error);
  });
}

console.log(getreq())

0 Answers0