Skip to content

Commit b3e821e

Browse files
committed
プログラム後の説明を追加
1 parent 29203b1 commit b3e821e

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

docs/3-web-servers/04-server/index.mdx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,12 @@ app.get("/", (request, response) => {
242242
app.listen(3000);
243243
```
244244

245+
イベントハンドラの中で、プログラムではまず `fs.readFileSync` 関数を用いて `index.html` ファイルの内容を文字列として `index` に読み込んでいます。
246+
247+
次の行では、配列である `names` を HTML として解釈可能な文字列の `namesAsHTML` に変換しています。
248+
249+
その次の行の `index.replace` で、`index` の中の `"{users}"``namesAsHTML` に置換されます。
250+
245251
:::
246252

247253
{/* prettier-ignore */}

0 commit comments

Comments
 (0)