Returning data from Axios API
I am trying to use a Node.JS application to make and receive API requests. It does a get request to another server using Axios with data it receives from an API call it receives. The second snippet is when the script returns the data from the call in. It will actually take it and write to the console, but it won't send it back in the second API. function axiosTest () { axios.get(url) .then(function (response) { console.log(response.data); // I need this data here ^^ return response.data; }) .catch(function (error) { console.log(error); }); } ... axiosTestResult = axiosTest(); response.json(