Похожие чаты

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 ответов

45 просмотров

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

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

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

Господа, а что сейчас вообще с рынком труда на делфи происходит? Какова ситуация?
Rꙮman Yankꙮvsky
29
А вообще, что может смущать в самой Julia - бы сказал, что нет единого стандартного подхода по многим моментам, поэтому многое выглядит как "хаки" и произвол. Короче говоря, с...
Viktor G.
2
@Benzenoid can you tell me the easiest, and safest way to bu.y HEX now?
Živa Žena
20
This is a question from my wife who make a fortune with memes 😂😂 About the Migration and Tokens: 1. How will the old tokens be migrated to the new $LGCYX network? What is th...
🍿 °anton°
2
30500 за редактор? )
Владимир
47
а через ESC-код ?
Alexey Kulakov
29
What is the Dex situation? Agora team started with the Pnetwork for their dex which helped them both with integration. It’s completed but as you can see from the Pnetwork ann...
Ben
1
Гайс, вопрос для разносторонее развитых: читаю стрим с юарта, нада выделять с него фреймы с определенной структурой, если ли чо готовое, или долбаться с ринг буффером? нада у...
Vitaly
9
Anyone knows where there are some instructions or discort about failed bridge transactions ?
Jochem
21
@lozuk how do I get my phex copies of my ehex from a atomic wallet, to move to my rabby?
Justfrontin 👀
11
Карта сайта