You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
*[Deploying the App via GitHub Pages](#deploying-the-app-via-github-pages)
45
46
*[Linting and formatting code](#linting-and-formatting-code)
46
47
*[Support for offline applications](#support-for-offline-applications)
@@ -192,6 +193,33 @@ Before running the tests make sure you are serving the app via `ng serve`.
192
193
193
194
End-to-end tests are run via [Protractor](https://angular.github.io/protractor/).
194
195
196
+
### Proxy To Backend
197
+
Using the proxying support in webpack's dev server we can highjack certain urls and send them to a backend server.
198
+
We do this by passing a file to `--proxy-config`
199
+
200
+
Say we have a server running on `http://localhost:3000/api` and we want all calls th `http://localhost:4200/api` to go to that server.
201
+
202
+
We create a file next to projects `package.json` called `proxy.conf.json`
203
+
with the content
204
+
205
+
```
206
+
{
207
+
"/api": {
208
+
"target": "http://localhost:3000",
209
+
"secure": false
210
+
}
211
+
}
212
+
```
213
+
214
+
You can read more about what options are available here [webpack-dev-server proxy settings](https://webpack.github.io/docs/webpack-dev-server.html#proxy)
215
+
216
+
and then we edit the `package.json` file's start script to be
0 commit comments