fix(ui): 🐛 workaround cra proxy bug

ref https://github.com/facebook/create-react-app/issues/11762\#issuecomment-1001295074
This commit is contained in:
Collin M. Barrett 2022-01-22 11:15:48 -06:00
parent 4a2a4272ba
commit 8cd6889be1
3 changed files with 12 additions and 1 deletions

BIN
web/package-lock.json generated

Binary file not shown.

View file

@ -16,6 +16,7 @@
"customize-cra": "^1.0.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-prettier": "^4.0.0",
"http-proxy-middleware": "^2.0.1",
"less": "^4.1.2",
"less-loader": "^7.3.0",
"prettier": "^2.5.1",
@ -34,7 +35,6 @@
"test": "react-app-rewired test",
"eject": "react-scripts eject"
},
"proxy": "http://localhost:8080",
"eslintConfig": {
"extends": [
"react-app",

11
web/src/setupProxy.js Normal file
View file

@ -0,0 +1,11 @@
const { createProxyMiddleware } = require("http-proxy-middleware");
module.exports = function (app) {
app.use(
"/api",
createProxyMiddleware({
target: "http://localhost:8080",
changeOrigin: true,
})
);
};