About forwarded ports
ポート転送を使用すると、Codespaces 内で実行されている TCP ポートにアクセスできます。 For example, if you're running a web application on port 4000, you can access the application from your browser to test and debug the application.
When an application running inside a codespace outputs a port to the console, Codespaces detects the localhost URL pattern and automatically forwards the port. You can click on the URL in the terminal to open the port in a browser. たとえば、アプリケーションが http://127.0.0.1:4000 または http://localhost:4000 をコンソールに出力する場合、ログは出力をポート 4000 のクリック可能な URL に自動的に変換します。

ポートの手動転送、転送されたポートへのラベル付け、転送されたポートのパブリックへの共有、転送されたポートの codespace 設定への追加ができます。
Forwarding a port
You can manually forward a port that wasn't forwarded automatically.
- codespaceで、テキストエディタの下で"Ports(ポート)"をクリックしてください。

- Under the list of ports, click Add port.

- Type the port number or address, then press enter.

Labeling a port
You can label a port to make the port more easily identifiable in a list.
- codespaceで、テキストエディタの下で"Ports(ポート)"をクリックしてください。

- Hover over the port you want to label, then click the label icon.

- ポートのラベルを入力し、Enterを押してください。

Sharing a port
If you want to share a forwarded port with others, you need to make the port public. After you make a port public, anyone with the port's URL can view the running application without needing to authenticate.
- codespaceで、テキストエディタの下で"Ports(ポート)"をクリックしてください。

- Right click the port you want to share, then click Make Public.

- To the right of the local address for the port, click the copy icon.

- Send the copied URL to the person you want to share the port with.
Adding a port to the codespace configuration
You can add a forwarded port to the Codespaces configuration for the repository, so the port will automatically be forwarded for all codespaces created from the repository. After you update the configuration, any previously created codespaces must be rebuilt for the change to apply. 詳しい情報については、「プロジェクトの Codespaces を設定する」を参照してください。
forwardPorts プロパティで .devcontainer.json ファイルで転送ポートを手動で設定するか、codespace の [Ports] パネルを使用できます。
- codespaceで、テキストエディタの下で"Ports(ポート)"をクリックしてください。

- Right click the port you want to add to the codespace configuration, then click Set Label and Update devcontainer.json.

- ポートのラベルを入力し、Enterを押してください。
