Answer the question
In order to leave comments, you need to log in
Why can't Axios see the file?
Hello, on Vue.JS using Axios I get data from a JSON file, everything works fine:
created() {
axios
.get('http://localhost:8080/json/cars.json')
.then(response => (this.info = response.data));
}
axios.post('http://localhost:8080/json/cars.json', {
id: '3',
name: 'Flintstone'
})
Answer the question
In order to leave comments, you need to log in
You cannot directly enter data to the server through the client (JS). There must be a script on the server that takes your data, validates it, and saves it to a file.
It doesn't work like that. On the server side, there should be a POST request handler that will update the contents of the file
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question