Within my src/vue.config.js
file, I have the following configuration:
module.exports = {
devServer: {
proxy: {
'/api': {
target: 'http://localhost:8081',
changeOrigin: true,
},
},
},
};
When I call the API using the following axios request:
axios.get('/api/parts')
.then(result => commit('updateParts', result.data))
.catch(console.error);
However, instead of receiving the expected data, I continue to encounter the following error message:
Error: "Request failed with status code 404"
Upon further investigation, I noticed that the request is being directed to port 8080 instead of 8081. Interestingly, I can access the API without any issues through a web browser.
How should I go about debugging this issue?