Похожие чаты

On frontend if I change axios from axios.get('/api/accounts') to axios.get('http://localhost:5000/api/accounts')

it works fine
why does axios.get('/api/accounts') does not work if I have added proxy: http://localhost:5000 in package.json??

8 ответов

9 просмотров

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?

Adi- Автор вопроса
Pedro Aguiar
Show us that section of your package.json

{ "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)

Adi- Автор вопроса
Adi
{ "name": "myapp", "version": "0.1.0", "priv...

Try changing this: "package.json": "http://localhost:5000" To this: "package.json": { "*": "http://[::1]:5000" }

Adi
it is in package.json

I see... Did you already try restarting backend and frontend?

Adi- Автор вопроса
Pedro Aguiar
Try changing this: "package.json": "http://lo...

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

Похожие вопросы

Обсуждают сегодня

Здравствуйте! Есть вопросы по ПК: 1.1. Безопасно ли запускать программы, которым я не доверяю, в виртуальной машине под KVM+qemu? (x86_64) 1.2. То же самое при использовании ...
Pavel
5
Hi everyone! I have a two-folded message to share today. First: updates and news, as we are being asked for those. We still want to go like we did the last 6 years: we w...
Marten | Unibright.io
31
У меня вопрос, а какой уровень оптимизации ставить при сборке на i5 4 ядра 16G ddr3 ОЗУ и видюха Geforce GTX 970?
Sir Jiga
18
Скажите, можно ли как-то "переместить" динамический массив из одной переменной в другую? Скажем, переместить из TList<> в TArray<>. Именно переместить, а не скопировать. Если ...
Eugene Krasnikov (ᴊɪɴ x)
37
Happy Friday and happy CartesiWeekly! This week on the list: 🪲 Bug Buster Update 🎥 Erick de Moura’s interview with Ornella from Web3TV 👽 Thriving Cartesi alien 🇧🇷 SBRC hackat...
Nida | Cartesi - Never DM first or ask for funds!
1
Oh.... Admins at the main TG is already muted me. How many months Sir you muted me? Or forever if you are here @Janevietani @JohnnySonic
Charles Dar
28
Вот еще криповенькая штука. uMain.pas(517,3) Warning: Case statement does not handle all possible cases И ЧО? 😂
Александр (Rouse_) Багель
20
комрады, че-та лыжы не едут var tmpFont: TFont; begin tmpFont:= TFont.Create; try case rgFontColor.ItemIndex of 0: tmpFont.Color:= clWindowText; 1: tmpFo...
Ed Doc
34
Интересно, нет ли какого-то способа получить из dll не адрес самой метки, а адрес со смещением?
The Bird of Hermes
54
.model small .stack 100h .data a db 'Hello, World!', '$' ; исходная строка b db 20 dup(?) ; строка b с запасом на максимальную длину .code main: ...
Алексей -man
3
Карта сайта