axios.get('/api') .catch(function (error) { if (error.response) { console.log(error.response.status); } });