无法加载资源:使用react时服务器响应状态为500(内部服务器错误)

问题描述 投票:0回答:1

前端在

port:3000
上运行,后端在
port:4000
上运行。 所以我做了这个功能,但是我的组件仍然不可见。

我创建了一个文件

setupProxy.js

const {createProxyMiddleware} = require('http-proxy-middleware');

module.exports = function (app) {
  app.use(
    '/api',
    createProxyMiddleware({
      target: 'https://192.168.0.156:4000',
      changeOrigin: true,
    }),
  );
};
javascript http-status-code-500
1个回答
0
投票

尝试使用

http://localhost:3000
,它应该可以工作,因为您的 Express 应用程序在端口 4000 上运行并在端口 3000 上做出反应。

© www.soinside.com 2019 - 2024. All rights reserved.