Axios Promises

Axios always returns a promise on a get()

const axios = require('axios');
 
module.exports = {
    fetchPopularRepos: function (language) {
        var encodedURI = window.encodeURI('https://api.github.com/search/repositories?q=stars:>1+language:'+ language + '&sort=stars&order=desc&type=Repositories');
 
        return axios.get(encodedURI)
          .then(function (response) {
            return response.data.items;
          });
    }
};
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License