I am using angular-cli and to properly forward my requests to my backend using proxy I use the following config (proxy-config.json):
{
"/api/*": {
"target": "http://mybackend.com:1234",
"changeOrigin": true,
"secure": false,
"logLevel": "debug"
}
}
I serve the files using ng serve --proxy-config proxy-config.json
This works as expected, however I am using many different branches on different ports for testing purposes and I want to be able to easily change the backend port (in this case 1234) to something else without editing the file every time.
In an angularjs project with grunt I did something like grunt serve:dev -r 1234 where -r meant the proxy port.