Axios Example

node v10.24.1
version: 1.0.0
endpointsharetweet
const axios = require('axios') // NOTE: VALID way to create resolved promise const p = axios.get('https://api.github.com/users/wolven531/repos') console.log('promise created') p.then(({ data, status, statusText }) => { if (status !== 200) { throw new Error(statusText) } console.log('inside then... resolution.data=', data) }) .catch(err => { console.log(err) }) .finally(() => { console.log('executing the finally...') })
Loading…

no comments

    sign in to comment