Skip to content

Commit 8ae5d0f

Browse files
committed
docs: use html extension and format
1 parent 1d50228 commit 8ae5d0f

File tree

2 files changed

+39
-42
lines changed

2 files changed

+39
-42
lines changed

Diff for: โ€Ždocs/fr/guide/essentials/history-mode.md

+17-17
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Le mode par dรฉfaut de `vue-router` est le _mode hash_. Il utilise la partie has
44

55
Pour nous passer du hash, nous pouvons utiliser le **mode historique** qui utilisera l'API `history.pushState` afin de permettre une navigation sans rechargement de page :
66

7-
``` js
7+
```js
88
const router = new VueRouter({
99
mode: 'history',
1010
routes: [...]
@@ -49,21 +49,23 @@ const http = require('http')
4949
const fs = require('fs')
5050
const httpPort = 80
5151

52-
http.createServer((req, res) => {
53-
fs.readFile('index.htm', 'utf-8', (err, content) => {
54-
if (err) {
55-
ย  ย  ย console.log(`Impossible d'ouvrir le fichier "index.htm"`)
56-
}
52+
http
53+
.createServer((req, res) => {
54+
fs.readFile('index.html', 'utf-8', (err, content) => {
55+
if (err) {
56+
console.log(`Impossible d'ouvrir le fichier "index.html"`)
57+
}
58+
59+
res.writeHead(200, {
60+
'Content-Type': 'text/html; charset=utf-8'
61+
})
5762

58-
res.writeHead(200, {
59-
'Content-Type': 'text/html; charset=utf-8'
63+
res.end(content)
6064
})
61-
62-
res.end(content)
6365
})
64-
}).listen(httpPort, () => {
65-
console.log('Le serveur รฉcoute ร  : http://localhost:%s', httpPort)
66-
})
66+
.listen(httpPort, () => {
67+
console.log('Le serveur รฉcoute ร  : http://localhost:%s', httpPort)
68+
})
6769
```
6870

6971
### Node.js avec Express
@@ -126,12 +128,10 @@ Ajouter ceci ร  votre fichier `firebase.json` :
126128

127129
Il y a une limitation a tout ceci. Votre serveur ne renverra plus les erreurs 404 des chemins qui ne sont pas trouvรฉs puisqu'il va servir ร  prรฉsent le fichier `index.html`. Pour contourner ce problรจme, vous pouvez implรฉmenter une route concordant avec toutes les adresses en 404 dans votre application Vue :
128130

129-
``` js
131+
```js
130132
const router = new VueRouter({
131133
mode: 'history',
132-
routes: [
133-
{ path: '*', component: NotFoundComponent }
134-
]
134+
routes: [{ path: '*', component: NotFoundComponent }]
135135
})
136136
```
137137

Diff for: โ€Ždocs/kr/guide/essentials/history-mode.md

+22-25
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
ํ•ด์‹œ๋ฅผ ์ œ๊ฑฐํ•˜๊ธฐ ์œ„ํ•ด ๋ผ์šฐํ„ฐ์˜ **history ๋ชจ๋“œ** ๋ฅผ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. `history.pushState` API๋ฅผ ํ™œ์šฉํ•˜์—ฌ ํŽ˜์ด์ง€๋ฅผ ๋‹ค์‹œ ๋กœ๋“œํ•˜์ง€ ์•Š๊ณ ๋„ URL ํƒ์ƒ‰์„ ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
66

7-
``` js
7+
```js
88
const router = new VueRouter({
99
mode: 'history',
1010
routes: [...]
@@ -43,28 +43,29 @@ location / {
4343
#### Native Node.js
4444

4545
```js
46-
const http = require("http")
47-
const fs = require("fs")
46+
const http = require('http')
47+
const fs = require('fs')
4848
const httpPort = 80
4949

50-
http.createServer((req, res) => {
51-
fs.readFile("index.htm", "utf-8", (err, content) => {
52-
if (err) {
53-
console.log('We cannot open "index.htm" file.')
54-
}
50+
http
51+
.createServer((req, res) => {
52+
fs.readFile('index.html', 'utf-8', (err, content) => {
53+
if (err) {
54+
console.log('We cannot open "index.html" file.')
55+
}
5556

56-
res.writeHead(200, {
57-
"Content-Type": "text/html; charset=utf-8"
58-
})
57+
res.writeHead(200, {
58+
'Content-Type': 'text/html; charset=utf-8'
59+
})
5960

60-
res.end(content)
61+
res.end(content)
62+
})
63+
})
64+
.listen(httpPort, () => {
65+
console.log('Server listening on: http://localhost:%s', httpPort)
6166
})
62-
}).listen(httpPort, () => {
63-
console.log("Server listening on: http://localhost:%s", httpPort)
64-
})
6567
```
6668

67-
6869
#### Express์™€ Node.js
6970

7071
Node.js/Express์˜ ๊ฒฝ์šฐ [connect-history-api-fallback ๋ฏธ๋“ค์›จ์–ด](https://github.com/bripkens/connect-history-api-fallback)๋ฅผ ๊ณ ๋ คํ•ด๋ณด์„ธ์š”.
@@ -87,29 +88,25 @@ Node.js/Express์˜ ๊ฒฝ์šฐ [connect-history-api-fallback ๋ฏธ๋“ค์›จ์–ด](https://gi
8788
</rule>
8889
</rules>
8990
</rewrite>
90-
<httpErrors>
91-
<remove statusCode="404" subStatusCode="-1" />
91+
<httpErrors>
92+
<remove statusCode="404" subStatusCode="-1" />
9293
<remove statusCode="500" subStatusCode="-1" />
93-
<error statusCode="404" path="/survey/notfound" responseMode="ExecuteURL" />
94+
<error statusCode="404" path="/survey/notfound" responseMode="ExecuteURL" />
9495
<error statusCode="500" path="/survey/error" responseMode="ExecuteURL" />
9596
</httpErrors>
9697
<modules runAllManagedModulesForAllRequests="true"/>
9798
</system.webServer>
9899
</configuration>
99100
```
100101

101-
102102
## ์ฃผ์˜ ์‚ฌํ•ญ
103103

104104
์ฃผ์˜ ์‚ฌํ•ญ์ด ์žˆ์Šต๋‹ˆ๋‹ค. ์—ฌ๋Ÿฌ๋ถ„์˜ ์„œ๋ฒ„๋Š” 404 ์—๋Ÿฌ๋ฅผ ๋ณด๊ณ ํ•˜์ง€ ์•Š์„ ๊ฒƒ์ž…๋‹ˆ๋‹ค. ์™œ๋ƒํ•˜๋ฉด ๋ชจ๋“  ๋ฐœ๊ฒฌ๋˜์ง€ ์•Š์€ ๊ฒฝ๋กœ๊ฐ€ ์ด์ œ `index.html` ํŒŒ์ผ์„ ์ œ๊ณตํ•˜๊ธฐ ๋•Œ๋ฌธ์ž…๋‹ˆ๋‹ค. ์ด ๋ฌธ์ œ๋ฅผ ํ•ด๊ฒฐํ•˜๋ ค๋ฉด Vue ์•ฑ์—์„œ catch-all ๋ผ์šฐํŠธ๋ฅผ ๊ตฌํ˜„ํ•˜์—ฌ 404 ํŽ˜์ด์ง€๋ฅผ ํ‘œ์‹œํ•ด์•ผํ•ฉ๋‹ˆ๋‹ค.
105105

106-
107-
``` js
106+
```js
108107
const router = new VueRouter({
109108
mode: 'history',
110-
routes: [
111-
{ path: '*', component: NotFoundComponent }
112-
]
109+
routes: [{ path: '*', component: NotFoundComponent }]
113110
})
114111
```
115112

0 commit comments

Comments
ย (0)