I put the line 'proxy': 'http://192.168.1.36:4000' which corresponds to the IP address and the port of my expressjs API but when I perform a fetch to retrieve information on my server I get an error like:> POST http: // localhost: 3000 / api / users / login 400 (Bad Request). From what I understood from the error, the fetch uses the port of my react app and not that of my express API. Port 3000 is not my API's.
{
"name": "portfolio",
"version": "1.0.0",
"private": true,
"proxy": "http://192.168.1.36:4000", // This line
"dependencies": {
"@testing-library/jest-dom": "^4.2.4",
"@testing-library/react": "^9.5.0",
"@testing-library/user-event": "^7.2.1",
"react": "^17.0.1",
"react-dom": "^17.0.1",
"react-redux": "^7.2.2",
"react-router-dom": "^5.2.0",
"react-scripts": "4.0.1",
"redux": "^4.0.5",
"redux-thunk": "^2.3.0"
},
question from:
https://stackoverflow.com/questions/65933848/react-cra-proxy-issue 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…