angular run with proxy
snippet in javascript

angular run with proxy

user4737

# Create Proxy file proxy.conf.json in root folder with the below content

{
  "/api/*": {
    "target": "http://localhost:8080",
    "secure": false,
    "logLevel": "debug",
    "changeOrigin": true,
    "pathRewrite": { "^/api": "" } // needed if you want to change api to empty when calling your backend service
  }
}

# when you run use

ng serve --proxy-config proxy.conf.json