Axios Example w/ Await

node v10.24.1
version: 2.0.0
endpointsharetweet
const axios = require('axios') const execFunc = async () => { try { const { data, status, statusText } = await axios.get('https://api.github.com/users/wolven531/repos') if (status !== 200) { throw new Error(statusText) } console.log('inside then... resolution.data=', data) } catch(err) { console.log(err) } console.log('executing the finally...') } execFunc()
Loading…

no comments

    sign in to comment