Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular HPM localhost error from while trying to proxy request /api/books from localhost:4200 to http://localhost:3333

Been trying for a few hours to get this issue fixed but cant make a post request with this error. At first i was using ng serve but then started using npm start but still got errors.

Error:

[HPM] Error occurred while trying to proxy request /api/books from localhost:4200 to http://localhost:3333 (ECONNREFUSED) (https://nodejs.org/api/errors.html#errors_common_system_errors)

My proxy file:

{
  "/api/*": {
    "target": "https://localhost:4200",
    "secure": false,
    "changeOrigin": true,
    "logLevel": "debug"
  }
}
like image 703
iKreateCode Avatar asked Jan 27 '26 13:01

iKreateCode


1 Answers

Is this issue with NX Monorepo ? If yes, you are just running this command :

ng serve

In a new tab of terminal, also run the command :

ng serve api

Since both servers need to be started.

like image 196
Anmol Jain Avatar answered Jan 30 '26 04:01

Anmol Jain