Node.js 无法从我的前端使用axios发送表单数据。获取网络错误。但是当我试图从邮递员那里点击后端时,它工作得很好

Node.js 无法从我的前端使用axios发送表单数据。获取网络错误。但是当我试图从邮递员那里点击后端时,它工作得很好,node.js,reactjs,axios,Node.js,Reactjs,Axios,我在下面写过。我尝试了不添加标题和使用标题。我已将标题添加到我的后台文件的中间件中。但我仍然得到网络错误。任何建议都会有帮助 this.data = { name: this.state.name, email: this.state.email, username: this.state.username, password: this.state.password, }; this.headers = { 'Content-Type': 'application/jso

我在下面写过。我尝试了不添加标题和使用标题。我已将标题添加到我的后台文件的中间件中。但我仍然得到网络错误。任何建议都会有帮助

this.data = {
  name: this.state.name,
  email: this.state.email,
  username: this.state.username,
  password: this.state.password,
};

this.headers = {
  'Content-Type': 'application/json; charset=utf-8',
  Accept: 'application/json',
};
Axios.post('http://localhost:8080/api/auth/signup', this.data, this.headers)
  .then((res) => {
    console.log(res);
  })
  .catch((err) => {
    console.log(err);
  });


您好,如果您发布所有相关信息,我们最容易回答您的问题。请发布您得到的错误,以及至少正在工作的后端代码。谢谢如果它是从邮递员那里工作的,这意味着浏览器正在做一些事情。例如,附加标题、发送选项请求等。