'Using Angular Proxy

Im trying to use angular proxy to proxy to my backend server. My server is running on http://localhost:8000 My angular server is running on http://localhost:4200

If the API makes a call to http://localhost:4200/api/bacon. I want it proxied to http://localhost:8000/api/bacon. However I only want calls that start with /api to be proxied.

My proxy.conf.json file looks like this.

{
  "/api/*":
  {
    "target": "http://localhost:8000/api",
    "secure": false
  }
}

And one of my api calls will look like this. http://localhost:4200/api/yemen

In this case I expect it to be proxied to http://localhost:8000/api/yemen

However it does not seem to be working



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source