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
Copy file name to clipboardExpand all lines: adev-ja/src/content/events/v21.en.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,4 @@
1
-

1
+

Copy file name to clipboardExpand all lines: adev-ja/src/content/tools/cli/serve.en.md
+22-16Lines changed: 22 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,8 +4,7 @@ You can serve your Angular CLI application with the `ng serve` command.
4
4
This will compile your application, skip unnecessary optimizations, start a devserver, and automatically rebuild and live reload any subsequent changes.
5
5
You can stop the server by pressing `Ctrl+C`.
6
6
7
-
`ng serve` only executes the builder for the `serve` target in the default project as specified in `angular.json`.
8
-
While any builder can be used here, the most common (and default) builder is `@angular-devkit/build-angular:dev-server`.
7
+
`ng serve` only executes the builder for the `serve` target in the default project as specified in `angular.json`. While any builder can be used here, the most common (and default) builder is `@angular/build:dev-server`.
9
8
10
9
You can determine which builder is being used for a particular project by looking up the `serve` target for that project.
11
10
@@ -17,10 +16,10 @@ You can determine which builder is being used for a particular project by lookin
17
16
"architect": {
18
17
// `ng serve` invokes the Architect target named `serve`.
@@ -29,21 +28,19 @@ You can determine which builder is being used for a particular project by lookin
29
28
30
29
```
31
30
32
-
This page discusses usage and options of `@angular-devkit/build-angular:dev-server`.
33
-
34
31
## Proxying to a backend server
35
32
36
-
Use [proxying support](https://webpack.js.org/configuration/dev-server/#devserverproxy) to divert certain URLs to a backend server, by passing a file to the `--proxy-config` build option.
33
+
Use [proxying support](https://vite.dev/config/server-options#server-proxy) to divert certain URLs to a backend server, by passing a file to the `--proxy-config` build option.
37
34
For example, to divert all calls for `http://localhost:4200/api` to a server running on `http://localhost:3000/api`, take the following steps.
38
35
39
36
1. Create a file `proxy.conf.json` in your project's `src/` folder.
40
37
1. Add the following content to the new proxy file:
41
38
42
39
```json
43
40
{
44
-
"/api": {
45
-
"target": "http://localhost:3000",
46
-
"secure": false
41
+
"/api/**": {
42
+
"target": "http://localhost:3000",
43
+
"secure": false
47
44
}
48
45
}
49
46
```
@@ -56,10 +53,10 @@ For example, to divert all calls for `http://localhost:4200/api` to a server run
@@ -70,7 +67,16 @@ For example, to divert all calls for `http://localhost:4200/api` to a server run
70
67
71
68
1. To run the development server with this proxy configuration, call `ng serve`.
72
69
73
-
Edit the proxy configuration file to add configuration options; following are some examples.
74
-
For a detailed description of all options, refer to the [webpack DevServer documentation](https://webpack.js.org/configuration/dev-server/#devserverproxy) when using `@angular-devkit/build-angular:browser`, or the [Vite DevServer documentation](https://vite.dev/config/server-options#server-proxy) when using `@angular-devkit/build-angular:browser-esbuild` or `@angular-devkit/build-angular:application`.
70
+
NOTE: To apply changes made to your proxy configuration file, you must restart the `ng serve` process.
71
+
72
+
### Path matching behavior depends on the builder
73
+
74
+
**`@angular/build:dev-server`** (based on [Vite](https://vite.dev/config/server-options#server-proxy))
75
+
76
+
-`/api` matches only `/api`.
77
+
-`/api/*` matches `/api/users` but not `/api/users/123`.
78
+
-`/api/**` matches `/api/users` and `/api/users/123`.
79
+
80
+
**`@angular-devkit/build-angular:dev-server`** (based on [Webpack DevServer](https://webpack.js.org/configuration/dev-server/#devserverproxy))
75
81
76
-
NOTE: If you edit the proxy configuration file, you must relaunch the `ng serve` process to make your changes effective.
82
+
-`/api` matches `/api` and any sub-paths (equivalent to `/api/**`).
0 commit comments