Skip to content

Commit 3b53ca9

Browse files
committed
docs: add contents
1 parent ee2c416 commit 3b53ca9

File tree

1 file changed

+99
-0
lines changed

1 file changed

+99
-0
lines changed

docs/content/memo.draft.md

+99
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,104 @@
11
# ハンズオン目次
22

3+
## Hello, chibivite!
4+
5+
```ts
6+
const app = connect()
7+
8+
app.use(function () {
9+
return 'Hello, chibivite!'
10+
})
11+
12+
app.listen()
13+
```
14+
15+
```sh
16+
node index.mjs
17+
```
18+
19+
## `index.html` へのアクセス
20+
21+
```html
22+
<!DOCTYPE html>
23+
<html lang="en">
24+
<head>
25+
<meta charset="UTF-8" />
26+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
27+
<title>chibivite</title>
28+
</head>
29+
<body>
30+
<h1>Hello, chibivite!</h1>
31+
</body>
32+
</html>
33+
```
34+
35+
```ts
36+
import fs from 'fs/promises'
37+
import connect from
38+
39+
const app = connect()
40+
41+
app.use(async function () {
42+
const content = await fs.readFile('./index.html', 'utf-8')
43+
return content
44+
})
45+
46+
app.listen()
47+
```
48+
49+
```sh
50+
node index.mjs
51+
```
52+
53+
## JavaScript へのアクセス
54+
55+
```html
56+
<!DOCTYPE html>
57+
<html lang="en">
58+
<head>
59+
<meta charset="UTF-8" />
60+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
61+
<title>chibivite</title>
62+
</head>
63+
<body>
64+
<h1>Hello, chibivite!</h1>
65+
<script type="module" src="/src/index.mjs"></script>
66+
</body>
67+
</html>
68+
```
69+
70+
```js
71+
console.log('Hello, chibivite!')
72+
```
73+
74+
```ts
75+
import fs from 'fs/promises'
76+
import connect from
77+
78+
const app = connect()
79+
80+
app.use(async function (req, _, next) {
81+
if (req.path.endsWith('.mjs')) {
82+
const content = await fs.readFile('./src/index.mjs', 'utf-8')
83+
return content
84+
}
85+
next()
86+
})
87+
88+
app.use(async function () {
89+
const content = await fs.readFile('./index.html', 'utf-8')
90+
return content
91+
})
92+
93+
app.listen()
94+
```
95+
96+
```sh
97+
node index.mjs
98+
```
99+
100+
---
101+
3102
- ツールのセットアップ
4103
- プロジェクトのセットアップ
5104
- Hello, chibivite!

0 commit comments

Comments
 (0)