How to use the axios.default.get function in axios

To help you get started, weโ€™ve selected a few axios examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github benjefferies / gogo-garage-opener / google-actions / functions / index.js View on Github external
async function getUserId(accessToken) {
  const response = await axios.get(
    getUserInfo(accessToken),
    { headers: { Authorization: `Bearer ${accessToken}` } }
  );
  console.log(response);
  return response.data["email"];
}
github Siteimprove / alfa / scripts / helpers / http.js View on Github external
async function fetch(url) {
  const response = await axios.get(url);
  return response.data;
}
github mykeels / farm-invest-cli / src / sites / thrive-agric.js View on Github external
module.exports = function () {
    return axios.get('https://www.thriveagric.com/#our-farms').then(res => {
        const $ = cheerio.load(res.data)
    
        fs.writeFileSync(thriveAgricHtml, res.data)
        
        const activeProducts = $('li.product.type-product').filter(function () {
            return $(this).find('span.out-of-stock-button').length == 0
        })
    
        const productList = activeProducts.map(function () {
            const title = $(this).find('h6[itemprop="name"]').text().trim()
            const price = $(this).find('span.woocommerce-Price-amount.amount').text().trim()
            const link = $(this).find('a.product-category.product-info').attr('href').trim()
            return { title, price, link }
        }).toArray()
    
        return productList
github mrellipse / toucan / src / ui / app / services / culture-service.ts View on Github external
resolveCulture(id: string) {
        return this.exec(Axios.get(BASE_URL + 'ResolveCulture', { params: { id } }))
            .then((value) => this.processPayload(value));
    }
github mrellipse / toucan / src / ui / app / services / authentication / authentication-service.ts View on Github external
verify() {
        let onSuccess = (res: AxiosResponse) => {

            let payload: IPayload = res.data;

            if (payload.message.messageTypeId === PayloadMessageTypes.success) {
                return payload.data;
            } else {
                throw new Error(payload.message.text);
            }
        }

        return Axios.get(VERIFICATION_CODE_URL)
            .then(onSuccess);
    }
}
github pedsm / deepHack / web / scraper.js View on Github external
async function getNumberOfSoftwarePages() {
    const r = await axios.get(`https://devpost.com/software/newest`);
    const $ = cheerio.load(r.data);
    return parseInt($('li.next.next_page').prev().text());
}
github mykeels / farm-invest-cli / src / sites / farm-crowdy.js View on Github external
module.exports = function () {
    return axios.get('https://www.farmcrowdy.com/farmshop').then(res => {
        const $ = cheerio.load(res.data)
    
        fs.writeFileSync(farmCrowdyHtml, res.data)
        
        const activeProducts = $('div.project').filter(function () {
            return $(this).find('div.project-image a span strong').length == 0
        })
    
        const productList = activeProducts.map(function () {
            const title = $(this).find('div.project-content h5').text().trim()
            const price = $(this).find('div.project-content span').text().trim()
            const link = $(this).find('div.project-image a').attr('href').trim()
            const returns = $(this).find('div.project-content p').text().trim()
            return { title, price, link, returns }
        }).toArray()
github XVincentX / apigateway-playground / invoiceService.js View on Github external
app.post('/:customerId/invoices/', (req, res) => {

  if (!req.params.customerId)
    return res.status(400).send("CustomerID hasn't been provided");

  axios.get(`http://customers:3000/${req.params.customerId}`, { headers: { "apikey": "userKey" } }).then(
    (response) => {
      if (response.data.length === 0)
        return res.status(404).send("No customer found");

      req.body.customer = req.params.customerId;

      Invoice.create(req.body)
        .then((entity) => res.status(201).send({ id: entity._id }))
        .catch((err) => res.status(500).send(err));

    },
    (err) => res.status(err.response.status || 500).send(err.message || err.code));

});
github kekland / is-instagram-up / src / connectivity.js View on Github external
const getServiceStatus = async (key, service) => {
  try {
    const response = await axios.get(service.url, {timeout: 10000,})
    return { service: key, up: true }
  }
  catch (e) {
    return { service: key, up: false }
  }
}
github pedsm / deepHack / web / scraper.js View on Github external
async function getSoftwareLinks(pageNum) {
    const r = await axios.get(`https://devpost.com/software/newest?page=${pageNum}`);
    const $ = cheerio.load(r.data);

    const links = $('a.link-to-software').map((i, element) => {
        return {
            'href': $(element).attr('href'),
            'projectSlug': $(element).attr('href').replace('https://devpost.com/software/', ''),
        };
    }).get();

    return links;
}