it works fine
why does axios.get('/api/accounts') does not work if I have added proxy: http://localhost:5000 in package.json??
Show us that section of your package.json
Where did you add the proxy ? Are you sure that 'add proxy' function is before de get call?
{ "name": "myapp", "version": "0.1.0", "private": true, "proxy": "http://localhost:5000", "dependencies": { "@emotion/react": "^11.4.1", "@emotion/styled": "^11.3.0", "@mui/icons-material": "^5.0.0", "@mui/lab": "^5.0.0-alpha.62", I am getting this message in console: Proxy error: Could not proxy request /api/timezone from localhost:3000 to http://localhost:5000/ (ECONNREFUSED)
it is in package.json
Try changing this: "package.json": "http://localhost:5000" To this: "package.json": { "*": "http://[::1]:5000" }
I see... Did you already try restarting backend and frontend?
After reading on internet I think that proxy only works for fetch API and not in case of axios see this https://github.com/facebook/create-react-app/issues/1378#issuecomment-272181608
Обсуждают сегодня