3

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"
  }
}
iKreateCode
  • 189
  • 3
  • 13

2 Answers2

1

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.

Anmol Jain
  • 336
  • 4
  • 12
-1

port 4200 is your app running on, isn't it? so then you have to change target url in proxy file to localhost:3300.

arunaDJ
  • 1
  • 3