From aea01b3a0c98817fe170beb759389ebb9c36ba58 Mon Sep 17 00:00:00 2001 From: Yuta Azumi Date: Tue, 13 Oct 2020 22:06:57 +0900 Subject: [PATCH 1/2] translate 1.4 separate express to japanese --- README.japanese.md | 8 ++++---- sections/projectstructre/separateexpress.japanese.md | 12 ++++++------ 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/README.japanese.md b/README.japanese.md index 171a0e54..56b780f8 100644 --- a/README.japanese.md +++ b/README.japanese.md @@ -92,13 +92,13 @@

-## ![✔] 1.4 Separate Express 'app' and 'server' +## ![✔] 1.4 Express の「アプリ」と「サーバー」を分離する -**TL;DR:** Avoid the nasty habit of defining the entire [Express](https://expressjs.com/) app in a single huge file - separate your 'Express' definition to at least two files: the API declaration (app.js) and the networking concerns (WWW). For even better structure, locate your API declaration within components +**TL;DR:** [Express](https://expressjs.com/) のアプリ全体を単一の巨大なファイルで定義するという厄介な習慣を回避します。- 「Express」の定義を、API宣言( app.js )とネットワーク関連( WWW )の少なくとも2つのファイルに分離してください。より良い構造にするためには、API 宣言をコンポーネント内に配置してください。 -**Otherwise:** Your API will be accessible for testing via HTTP calls only (slower and much harder to generate coverage reports). It probably won't be a big pleasure to maintain hundreds of lines of code in a single file +**さもないと:** API は HTTP 呼び出しのみでテストにアクセスできるようになります(カバレッジレポートを生成するのがより遅く、はるかに困難になります)。何百行ものコードを一つのファイルで管理するのは、おそらく大きな喜びではないでしょう。 -🔗 [**Read More: separate Express 'app' and 'server'**](/sections/projectstructre/separateexpress.md) +🔗 [**さらに読む: Express の「アプリ」と「サーバー」を分離する**](/sections/projectstructre/separateexpress.japanese.md)

diff --git a/sections/projectstructre/separateexpress.japanese.md b/sections/projectstructre/separateexpress.japanese.md index e35c67d2..43ce3728 100644 --- a/sections/projectstructre/separateexpress.japanese.md +++ b/sections/projectstructre/separateexpress.japanese.md @@ -1,14 +1,14 @@ -# Separate Express 'app' and 'server' +# Express の「アプリ」と「サーバー」を分離する

-### One Paragraph Explainer +### 一段落説明 -The latest Express generator comes with a great practice that is worth to keep - the API declaration is separated from the network related configuration (port, protocol, etc). This allows testing the API in-process, without performing network calls, with all the benefits that it brings to the table: fast testing execution and getting coverage metrics of the code. It also allows deploying the same API under flexible and different network conditions. Bonus: better separation of concerns and cleaner code +最新の Express ジェネレーターは、維持する価値がある素晴らしいプラクティスが付属しています。- API 宣言はネットワーク関連の設定 (ポート、プロトコルなど) から分離されています。これにより、ネットワークコールを実行せずに API をインプロセスでテストすることができ、高速なテスト実行やコードのカバレッジメトリクスの取得などのメリットが得られます。 また、柔軟で異なるネットワーク条件の下で同じ API をデプロイすることができます。ボーナス:懸念事項のより良い分離とよりクリーンなコード

-### Code example: API declaration, should reside in app.js/app.ts +### コード例: API 宣言は app.js/app.ts にあるべき ```javascript const app = express(); @@ -17,7 +17,7 @@ app.use('/api/events', events.API); app.use('/api/forms', forms); ``` -### Code example: Server network declaration, should reside in /bin/www +### コード例: サーバーネットワーク定義は /bin/www にあるべき
Javascript @@ -51,7 +51,7 @@ const server = http.createServer(app); ```
-### Example: test your API in-process using supertest (popular testing package) +### 例: supertest (一般的なテストパッケージ) を使用して API をインプロセスでテストする
Javascript From 845ab36f228751057266eccce06efe34124ed023 Mon Sep 17 00:00:00 2001 From: Yuta Azumi Date: Sat, 17 Oct 2020 22:07:41 +0900 Subject: [PATCH 2/2] fix format --- README.japanese.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.japanese.md b/README.japanese.md index b767b85b..90d495a8 100644 --- a/README.japanese.md +++ b/README.japanese.md @@ -94,7 +94,7 @@ ## ![✔] 1.4 Express の「アプリ」と「サーバー」を分離する -**TL;DR:** [Express](https://expressjs.com/) のアプリ全体を単一の巨大なファイルで定義するという厄介な習慣を回避します。- 「Express」の定義を、API宣言( app.js )とネットワーク関連( WWW )の少なくとも2つのファイルに分離してください。より良い構造にするためには、API 宣言をコンポーネント内に配置してください。 +**TL;DR:** [Express](https://expressjs.com/) のアプリ全体を単一の巨大なファイルで定義するという厄介な習慣を回避します。- 「Express」の定義を、API 宣言( app.js )とネットワーク関連( WWW )の少なくとも2つのファイルに分離してください。より良い構造にするためには、API 宣言をコンポーネント内に配置してください。 **さもないと:** API は HTTP 呼び出しのみでテストにアクセスできるようになります(カバレッジレポートを生成するのがより遅く、はるかに困難になります)。何百行ものコードを一つのファイルで管理するのは、おそらく大きな喜びではないでしょう。