Skip to content

Commit 2cfe193

Browse files
authored
feat(docs): translate CLI serve documentation to Japanese (#1067)
1 parent d8125fd commit 2cfe193

File tree

2 files changed

+115
-25
lines changed

2 files changed

+115
-25
lines changed
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
# Serving Angular apps for development
2+
3+
You can serve your Angular CLI application with the `ng serve` command.
4+
This will compile your application, skip unnecessary optimizations, start a devserver, and automatically rebuild and live reload any subsequent changes.
5+
You can stop the server by pressing `Ctrl+C`.
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`.
9+
10+
You can determine which builder is being used for a particular project by looking up the `serve` target for that project.
11+
12+
<docs-code language="json">
13+
14+
{
15+
"projects": {
16+
"my-app": {
17+
"architect": {
18+
// `ng serve` invokes the Architect target named `serve`.
19+
"serve": {
20+
"builder": "@angular-devkit/build-angular:dev-server",
21+
// ...
22+
},
23+
"build": { /* ... */ }
24+
"test": { /* ... */ }
25+
}
26+
}
27+
}
28+
}
29+
30+
</docs-code>
31+
32+
This page discusses usage and options of `@angular-devkit/build-angular:dev-server`.
33+
34+
## Proxying to a backend server
35+
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.
37+
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+
39+
1. Create a file `proxy.conf.json` in your project's `src/` folder.
40+
1. Add the following content to the new proxy file:
41+
42+
<docs-code language="json">
43+
44+
{
45+
"/api": {
46+
"target": "http://localhost:3000",
47+
"secure": false
48+
}
49+
}
50+
51+
</docs-code>
52+
53+
1. In the CLI configuration file, `angular.json`, add the `proxyConfig` option to the `serve` target:
54+
55+
<docs-code language="json">
56+
57+
{
58+
"projects": {
59+
"my-app": {
60+
"architect": {
61+
"serve": {
62+
"builder": "@angular-devkit/build-angular:dev-server",
63+
"options": {
64+
"proxyConfig": "src/proxy.conf.json"
65+
}
66+
}
67+
}
68+
}
69+
}
70+
}
71+
72+
</docs-code>
73+
74+
1. To run the development server with this proxy configuration, call `ng serve`.
75+
76+
Edit the proxy configuration file to add configuration options; following are some examples.
77+
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`.
78+
79+
NOTE: If you edit the proxy configuration file, you must relaunch the `ng serve` process to make your changes effective.
80+
81+
## `localhost` resolution
82+
83+
As of Node version 17, Node will _not_ always resolve `http://localhost:<port>` to `http://127.0.0.1:<port>`
84+
depending on each machine's configuration.
85+
86+
If you get an `ECONNREFUSED` error using a proxy targeting a `localhost` URL,
87+
you can fix this issue by updating the target from `http://localhost:<port>` to `http://127.0.0.1:<port>`.
88+
89+
See [the `http-proxy-middleware` documentation](https://github.com/chimurai/http-proxy-middleware#nodejs-17-econnrefused-issue-with-ipv6-and-localhost-705)
90+
for more information.

adev-ja/src/content/tools/cli/serve.md

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
# Serving Angular apps for development
1+
# 開発用にAngularアプリケーションを配信する
22

3-
You can serve your Angular CLI application with the `ng serve` command.
4-
This will compile your application, skip unnecessary optimizations, start a devserver, and automatically rebuild and live reload any subsequent changes.
5-
You can stop the server by pressing `Ctrl+C`.
3+
Angular CLIアプリケーションは、`ng serve`コマンドで配信できます。
4+
これにより、アプリケーションがコンパイルされ、不要な最適化がスキップされ、開発サーバーが起動し、その後の変更が自動的に再ビルドおよびライブリロードされます。
5+
サーバーは`Ctrl+C`を押して停止できます。
66

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`は、`angular.json`で指定されたデフォルトプロジェクトの`serve`ターゲットのビルダーのみを実行します。
8+
ここでは任意のビルダーを使用できますが、最も一般的(かつデフォルト)なビルダーは`@angular-devkit/build-angular:dev-server`です。
99

10-
You can determine which builder is being used for a particular project by looking up the `serve` target for that project.
10+
特定のプロジェクトで使用されているビルダーは、そのプロジェクトの`serve`ターゲットを調べることで判断できます。
1111

1212
<docs-code language="json">
1313

@@ -29,15 +29,15 @@ You can determine which builder is being used for a particular project by lookin
2929

3030
</docs-code>
3131

32-
This page discusses usage and options of `@angular-devkit/build-angular:dev-server`.
32+
このページでは、`@angular-devkit/build-angular:dev-server`の使用法とオプションについて説明します。
3333

34-
## Proxying to a backend server
34+
## バックエンドサーバーへのプロキシ {#proxying-to-a-backend-server}
3535

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.
37-
For example, to divert all calls for `http://localhost:4200/api` to a server running on `http://localhost:3000/api`, take the following steps.
36+
[プロキシサポート](https://webpack.js.org/configuration/dev-server/#devserverproxy)を使用して、特定のURLをバックエンドサーバーに転送するには、`--proxy-config`ビルドオプションにファイルを渡します。
37+
例えば、`http://localhost:4200/api`へのすべての呼び出しを`http://localhost:3000/api`で実行されているサーバーに転送するには、以下の手順を実行します。
3838

39-
1. Create a file `proxy.conf.json` in your project's `src/` folder.
40-
1. Add the following content to the new proxy file:
39+
1. プロジェクトの`src/`フォルダーに`proxy.conf.json`ファイルを作成します。
40+
1. 新しいプロキシファイルに以下の内容を追加します。
4141

4242
<docs-code language="json">
4343

@@ -50,7 +50,7 @@ For example, to divert all calls for `http://localhost:4200/api` to a server run
5050

5151
</docs-code>
5252

53-
1. In the CLI configuration file, `angular.json`, add the `proxyConfig` option to the `serve` target:
53+
1. CLI設定ファイル`angular.json`で、`serve`ターゲットに`proxyConfig`オプションを追加します。
5454

5555
<docs-code language="json">
5656

@@ -71,20 +71,20 @@ For example, to divert all calls for `http://localhost:4200/api` to a server run
7171

7272
</docs-code>
7373

74-
1. To run the development server with this proxy configuration, call `ng serve`.
74+
1. このプロキシ設定で開発サーバーを実行するには、`ng serve`を呼び出します。
7575

76-
Edit the proxy configuration file to add configuration options; following are some examples.
77-
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`.
76+
プロキシ設定ファイルを編集して設定オプションを追加します。以下にいくつかの例を示します。
77+
すべてのオプションの詳細については、`@angular-devkit/build-angular:browser`を使用する場合は[webpack DevServerドキュメント](https://webpack.js.org/configuration/dev-server/#devserverproxy)を、または`@angular-devkit/build-angular:browser-esbuild`または`@angular-devkit/build-angular:application`を使用する場合は[Vite DevServerドキュメント](https://vite.dev/config/server-options#server-proxy)を参照してください。
7878

79-
NOTE: If you edit the proxy configuration file, you must relaunch the `ng serve` process to make your changes effective.
79+
NOTE: プロキシ設定ファイルを編集した場合、変更を有効にするには`ng serve`プロセスを再起動する必要があります。
8080

81-
## `localhost` resolution
81+
## `localhost`の解決 {#localhost-resolution}
8282

83-
As of Node version 17, Node will _not_ always resolve `http://localhost:<port>` to `http://127.0.0.1:<port>`
84-
depending on each machine's configuration.
83+
Nodeバージョン17以降、Nodeは`http://localhost:<port>``http://127.0.0.1:<port>`に常に解決するとは限りません
84+
これは各マシンの設定に依存します。
8585

86-
If you get an `ECONNREFUSED` error using a proxy targeting a `localhost` URL,
87-
you can fix this issue by updating the target from `http://localhost:<port>` to `http://127.0.0.1:<port>`.
86+
もし`localhost`URLをターゲットとするプロキシを使用している際に`ECONNREFUSED`エラーが発生した場合、
87+
ターゲットを`http://localhost:<port>`から`http://127.0.0.1:<port>`に更新することで、この問題を解決できます。
8888

89-
See [the `http-proxy-middleware` documentation](https://github.com/chimurai/http-proxy-middleware#nodejs-17-econnrefused-issue-with-ipv6-and-localhost-705)
90-
for more information.
89+
[`http-proxy-middleware`のドキュメント`](https://github.com/chimurai/http-proxy-middleware#nodejs-17-econnrefused-issue-with-ipv6-and-localhost-705)を参照してください。
90+
詳細については。

0 commit comments

Comments
 (0)