I have a JSON file in my Vue JS project, nested in the folder structure
src/assets/json/people.json
I'm trying to make an axios request to the json resource in my App.vue file
export default {
name: "App",
data: function() {
return {
people: []
}
},
created: function() {
this.fetchPeople();
},
methods: {
fetchPeople: function() {
let url = "./src/assets/json/people.json"
axios.get(url)
.then(res => {
this.people = JSON.parse(res);
})
}
}
};
On my console, I'm getting the error below:
Failed to load resource: the server responded with a status of 404 (Not Found)
Uncaught (in promise) Error: Request failed with status code 404
at createError (createError.js?2d83:16)
at settle (settle.js?467f:17)
at XMLHttpRequest.handleLoad (xhr.js?b50d:59)