Skip to content

Commit 28d343e

Browse files
committed
docs: update proxy wiki
1 parent 24dc9b0 commit 28d343e

File tree

1 file changed

+18
-12
lines changed

1 file changed

+18
-12
lines changed

docs/documentation/stories/proxy.md

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,21 @@ We create a file next to our project's `package.json` called `proxy.conf.json` w
1818

1919
You can read more about what options are available [here](https://webpack.js.org/configuration/dev-server/#devserver-proxy).
2020

21-
We can then edit the `package.json` file's start script to be
21+
We can then add the `proxyConfig` option to the serve target:
2222

2323
```json
24-
"start": "ng serve --proxy-config proxy.conf.json",
24+
"architect": {
25+
"serve": {
26+
"builder": "@angular-devkit/build-angular:dev-server",
27+
"options": {
28+
"browserTarget": "rx-seven-project:build",
29+
"proxyConfig": "src/proxy.conf.json"
30+
},
2531
```
2632

27-
Now in order to run our dev server with our proxy config, we can simply call `npm start`.
33+
Now in order to run our dev server with our proxy config we can call `ng serve`.
2834

29-
**After each edit to the proxy.conf.json file remember to relaunch the `npm start` process to make your changes effective.**
35+
**After each edit to the proxy.conf.json file remember to relaunch the `ng serve` process to make your changes effective.**
3036

3137
### Rewriting the URL path
3238

@@ -105,10 +111,16 @@ const PROXY_CONFIG = [
105111
module.exports = PROXY_CONFIG;
106112
```
107113

108-
and make sure to point to the right file
114+
Make sure to point to the right file (`.js` instead of `.json`):
109115

110116
```json
111-
"start": "ng serve --proxy-config proxy.conf.js",
117+
"architect": {
118+
"serve": {
119+
"builder": "@angular-devkit/build-angular:dev-server",
120+
"options": {
121+
"browserTarget": "rx-seven-project:build",
122+
"proxyConfig": "src/proxy.conf.js"
123+
},
112124
```
113125

114126
### Bypass the Proxy
@@ -132,9 +144,3 @@ const PROXY_CONFIG = {
132144

133145
module.exports = PROXY_CONFIG;
134146
```
135-
136-
again, make sure to point to the right file
137-
138-
```json
139-
"start": "ng serve --proxy-config proxy.conf.js",
140-
```

0 commit comments

Comments
 (0)