axios.get('/api/data') .then(function (response) { // Handle the response data console.log(response.data); }) .catch(function (error) { // Handle any errors console.error(error); });