使用 Vue 和 axios post to json 文件问题

Using Vue and axios post to json file problem

我在将轴发布到本地 .json 文件时遇到问题。它给我一个错误:

POST http://localhost:8080/todolist.json 404 (Not Found)

TodoListEditor.vue?b9d6:110 Error: Request failed with status code 404
    at createError (createError.js?2d83:16)
    at settle (settle.js?467f:18)
    at XMLHttpRequest.handleLoad (xhr.js?b50d:77)

我尝试了很多地址方案,但结果都是一样的。当我将完全相同的地址传递给 axios.get() - 它 returns 正确的数据并读取文件。 这是我的部分代码:

axios.post('http://localhost:8080/todolist.json',
        this.todolist,{
        headers: {
          'Accept': 'application/json',
          'Content-Type': 'application/json',
          "Access-Control-Allow-Origin": "*",
        }
      }).then((response)=>{
        console.log(response);
      }).catch((error)=>{
        console.log(error);
      });

感谢帮助

HTTP请求的类型GET和POST各有各的作用。 GET 是检索信息的请求,POST 是写入数据的请求,服务器对每种方法的行为不同。上述错误表示服务器无法处理 POST 个请求的请求。

从上面的URL发送get请求似乎效果很好,因为这意味着引入todolist.json文件,而向特定文件发送post请求是不合适的。