1.41K viewsMern Amazona

while inspecting the element, under Network/Fetch/XHR/preview, I am getting following error–> Proxy error: Could not proxy request /api/products from localhost:3000 to http://localhost:5000/ (ECONNREFUSED).

Answer:

you get the proxy error when:

1- start frontend before the backend server

2- have an error in the backend terminal

please run the backend server in the backend folder first then go to the frontend folder and run npm start

also make sure you set the proxy like this: https://github.com/basir/amazona/blob/e700bc418280f1bd48d2e7594ca315ec4f95202b/frontend/package.json#L3

or there is an error in your backend code. check the terminal of the backend and fix the issue.

also restart the backend and frontend to test again.

Bassir Answered question October 13, 2022

you get the proxy error when:

1- start frontend before the backend server

2- have an error in the backend terminal

please run the backend server in the backend folder first then go to the frontend folder and run npm start

also make sure you set the proxy like this: https://github.com/basir/amazona/blob/e700bc418280f1bd48d2e7594ca315ec4f95202b/frontend/package.json#L3

or there is an error in your backend code. check the terminal of the backend and fix the issue.

also restart the backend and frontend to test again.

Bassir Answered question October 13, 2022