Last active
July 9, 2020 21:31
-
-
Save charlintosh/f51dbbd7fb286b44795526264195a857 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const axios = require('axios') | |
const doRequest = () => { | |
try { | |
return axios.get('https://thegreatapi.org/v1') | |
} catch (error) { | |
console.error(error) | |
} | |
} | |
const callAPI = async () => { | |
const response = doRequest() | |
.then(response => { | |
console.log(response); | |
console.log("It works!"); | |
}) | |
.catch(error => { | |
console.log(error) | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment