File tree Expand file tree Collapse file tree 2 files changed +5
-5
lines changed
Expand file tree Collapse file tree 2 files changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -30,7 +30,7 @@ npm install express
3030
3131続いて、次のような ` main.mjs ` を作成しましょう。
3232
33- ``` javascript title=main.js
33+ ``` javascript title=main.mjs
3434import express from " express" ;
3535const app = express ();
3636
@@ -107,7 +107,7 @@ Web サーバーにアクセスするために用いた `http://localhost:3000/`
107107
108108次の例では、` / ` 、` /script.js ` 、` /sub/ ` 、` /sub/script.js ` へのリクエストについて、それぞれファイルから読み込んでレスポンスを送信しています。
109109
110- ``` javascript
110+ ``` javascript title=main.mjs
111111import express from " express" ;
112112import { readFileSync } from " fs" ;
113113const app = express ();
@@ -132,7 +132,7 @@ app.listen(3000);
132132
133133` express.static ` 関数を用いると、このような「リクエストを受け取ったら、そのパスに応じて適切なファイルを読み込んでレスポンスとして返す」という一連の動作を簡単に記述できます。
134134
135- ``` javascript
135+ ``` javascript title=main.mjs
136136import express from " express" ;
137137
138138const app = express ();
@@ -154,7 +154,7 @@ app.listen(3000);
154154
155155前項のプログラムを書き換えて、複雑な HTML を出力できるようにしてみましょう。
156156
157- ``` javascript
157+ ``` javascript title=main.mjs
158158import express from " express" ;
159159const app = express ();
160160
Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ npm install cookie-parser
3636
3737を実行して、パッケージをインストールしましょう。Web サーバーのプログラムは次のようになります。
3838
39- ``` javascript
39+ ``` javascript title=main.mjs
4040import express from " express" ;
4141import cookieParser from " cookie-parser" ;
4242
You can’t perform that action at this time.
0 commit comments