Calling another webservice from my Strapi service

Not sure what is wrong with your code, but try this:

'use strict';
const axios = require('axios');

module.exports = ({ strapi }) => ({
  async validateWorldRequested() {
	try {
        const response = await axios.get('http://www.example.com/')
        console.log(response)    
        } 
        catch(error) {
            // handle error
        }
  },
});
1 Like