如何解决如何修复 vue config js 代理端口错误?
module.exports = {
devServer: {
proxy: {
"^/api": {
target: "http://localhost:3001",changeOrigin: true,secure:false,}
}
}
};
我的服务器在 3001 上工作,没有问题,我的 get 请求也在工作
const result = await axios.get(
"/api/staffs/"
);
this.staffs = result.data
this.loading = false
},```
but when I made a post request with,my first request working,I can add one element to the database,but when I make second request there is an error like;
Proxy error: Could not proxy request /api/staffs from localhost:8080 to http://localhost:3001/.
See https://nodejs.org/api/errors.html#errors_common_system_errors for more information (ECONNRESET).
here is my post request
async postStaffs() {
await axios.post("/api/staffs",{
name: { first:"asdassdeeed",last: "asddseedfdea" },});
},```
我尝试了 http://127.0.0.1:3001/ 和 pathRewrite,它们没有用。它昨天还在工作,现在我突然收到了这个错误。有谁知道如何解决这个问题?
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。