質問編集履歴
1
ディレクトリ構造、2ファイルの内容を追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -20,6 +20,48 @@
|
|
20
20
|
|
21
21
|
---
|
22
22
|
|
23
|
+
ディレクトリ構造
|
24
|
+
|
25
|
+
```
|
26
|
+
|
27
|
+
***/
|
28
|
+
|
29
|
+
├─ node_modules
|
30
|
+
|
31
|
+
├─ public
|
32
|
+
|
33
|
+
│ ├─ css
|
34
|
+
|
35
|
+
│ │ ├─ common.css
|
36
|
+
|
37
|
+
│ │ └─ reset.css
|
38
|
+
|
39
|
+
│ ├─ dist
|
40
|
+
|
41
|
+
│ │ └─ bundle.js
|
42
|
+
|
43
|
+
│ └─ html
|
44
|
+
|
45
|
+
│ └─ index.html
|
46
|
+
|
47
|
+
├─ script
|
48
|
+
|
49
|
+
│ └─ hyperapp.js
|
50
|
+
|
51
|
+
├─ .babelrc
|
52
|
+
|
53
|
+
├─ .gitignore
|
54
|
+
|
55
|
+
├─ package-lock.json
|
56
|
+
|
57
|
+
├─ package.json
|
58
|
+
|
59
|
+
├─ web-server.js
|
60
|
+
|
61
|
+
└─ webpack.config.js
|
62
|
+
|
63
|
+
```
|
64
|
+
|
23
65
|
package.json
|
24
66
|
|
25
67
|
```
|
@@ -164,6 +206,74 @@
|
|
164
206
|
|
165
207
|
```
|
166
208
|
|
209
|
+
web-server.js
|
210
|
+
|
211
|
+
```
|
212
|
+
|
213
|
+
const express = require('express');
|
214
|
+
|
215
|
+
const server = express();
|
216
|
+
|
217
|
+
const port = 3000;
|
218
|
+
|
219
|
+
const path = require('path');
|
220
|
+
|
221
|
+
|
222
|
+
|
223
|
+
server.set( 'view engine', 'ejs' );
|
224
|
+
|
225
|
+
server.use( '/' , express.static( __dirname+'/public' ) );
|
226
|
+
|
227
|
+
server.use( '/' , express.static( __dirname+'/public/html' ) );
|
228
|
+
|
229
|
+
server.use( '/' , express.static( __dirname+'/public/css' ) );
|
230
|
+
|
231
|
+
server.use( '/' , express.static( __dirname+'/public/dist' ) );
|
232
|
+
|
233
|
+
|
234
|
+
|
235
|
+
server.get( '/', ( request, response )=>{
|
236
|
+
|
237
|
+
response.status(200).sendfile( 'index' );
|
238
|
+
|
239
|
+
});
|
240
|
+
|
241
|
+
|
242
|
+
|
243
|
+
server.listen(port);
|
244
|
+
|
245
|
+
```
|
246
|
+
|
247
|
+
index.html
|
248
|
+
|
249
|
+
```
|
250
|
+
|
251
|
+
<!DOCTYPE html>
|
252
|
+
|
253
|
+
<html lang="ja">
|
254
|
+
|
255
|
+
<head>
|
256
|
+
|
257
|
+
<meta charset="UTF-8">
|
258
|
+
|
259
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
260
|
+
|
261
|
+
<title>***</title>
|
262
|
+
|
263
|
+
<script type="module" src="bundle.js"></script>
|
264
|
+
|
265
|
+
</head>
|
266
|
+
|
267
|
+
<body>
|
268
|
+
|
269
|
+
<main id="app"></main>
|
270
|
+
|
271
|
+
</body>
|
272
|
+
|
273
|
+
</html>
|
274
|
+
|
275
|
+
```
|
276
|
+
|
167
277
|
hyperapp.js
|
168
278
|
|
169
279
|
```
|