Skip to content

Commit 3424f61

Browse files
authored
Merge branch 'gh-pages' into 1421-docs-clean
2 parents e3cbb9e + e52698d commit 3424f61

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+335
-630
lines changed

_includes/api/en/4x/app-use.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,8 @@ mounting middleware.
7979
<tr>
8080
<td>Path</td>
8181
<td markdown="1">
82-
This will match paths starting with `/abcd`:
82+
Matches the exact path `/abcd` and any sub-paths starting with `/abcd/` (for example, `/abcd/foo`):
83+
8384

8485
```js
8586
app.use('/abcd', function (req, res, next) {

_includes/api/en/4x/res-clearCookie.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
<h3 id='res.clearCookie'>res.clearCookie(name [, options])</h3>
22

3-
Clears the cookie specified by `name`. For details about the `options` object, see [res.cookie()](#res.cookie).
3+
Clears the cookie with the specified `name` by sending a `Set-Cookie` header that sets its expiration date in the past.
4+
This instructs the client that the cookie has expired and is no longer valid. For more information
5+
about available `options`, see [res.cookie()](#res.cookie).
6+
7+
<div class="doc-box doc-warn" markdown="1">
8+
If the `maxAge` or `expires` options are set, the cookie may not be cleared depending on the time values provided,
9+
as Express does not ignore these options. It is therefore recommended to omit these options when calling this
10+
method. Passing these two options has been deprecated since Express v4.20.0.
11+
</div>
412

513
<div class="doc-box doc-notice" markdown="1">
614
Web browsers and other compliant clients will only clear the cookie if the given

_includes/api/en/5x/app-use.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,8 @@ mounting middleware.
8080
<tr>
8181
<td>Path</td>
8282
<td markdown="1">
83-
This will match paths starting with `/abcd`:
83+
Matches the exact path `/abcd` and any sub-paths starting with `/abcd/` (for example, `/abcd/foo`):
84+
8485

8586
```js
8687
app.use('/abcd', (req, res, next) => {

_includes/api/en/5x/res-clearCookie.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
11
<h3 id='res.clearCookie'>res.clearCookie(name [, options])</h3>
22

3-
Clears the cookie specified by `name`. For details about the `options` object, see [res.cookie()](#res.cookie).
3+
Clears the cookie with the specified `name` by sending a `Set-Cookie` header that sets its expiration date in the past.
4+
This instructs the client that the cookie has expired and is no longer valid. For more information
5+
about available `options`, see [res.cookie()](#res.cookie).
6+
7+
<div class="doc-box doc-notice" markdown="1">
8+
The `expires` and `max-age` options are being ignored completely.
9+
</div>
410

511
<div class="doc-box doc-notice" markdown="1">
612
Web browsers and other compliant clients will only clear the cookie if the given
7-
`options` is identical to those given to [res.cookie()](#res.cookie), excluding
8-
`expires` and `maxAge`.
13+
`options` is identical to those given to [res.cookie()](#res.cookie)
914
</div>
1015

1116
```js

_includes/head.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@
44
<meta name="viewport" content="width=device-width, initial-scale=1">
55
<link
66
rel="preload"
7-
href="/fonts/open-sans/woff2/OpenSans.woff2"
7+
href="/fonts/open-sans/woff2/open-sans-latin-wght-normal.woff2"
88
as="font"
99
type="font/woff2"
1010
crossorigin
1111
/>
1212
<link
1313
rel="preload"
14-
href="/fonts/open-sans/woff2/OpenSans-Italic.woff2"
14+
href="/fonts/open-sans/woff2/open-sans-latin-wght-italic.woff2"
1515
as="font"
1616
type="font/woff2"
1717
crossorigin

de/guide/migrating-5.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ You can find the list of available codemods [here](https://github.com/expressjs/
6666
<li><a href="#path-syntax">Path route matching syntax</a></li>
6767
<li><a href="#rejected-promises">Rejected promises handled from middleware and handlers</a></li>
6868
<li><a href="#express.urlencoded">express.urlencoded</a></li>
69+
<li><a href="#express.static.dotfiles">express.static dotfiles</a></li>
6970
<li><a href="#app.listen">app.listen</a></li>
7071
<li><a href="#app.router">app.router</a></li>
7172
<li><a href="#req.body">req.body</a></li>
@@ -469,6 +470,29 @@ Details of how Express handles errors is covered in the [error handling document
469470

470471
The `express.urlencoded` method makes the `extended` option `false` by default.
471472

473+
<h3 id="express.static.dotfiles">express.static dotfiles</h3>
474+
475+
In Express 5, the `express.static` middleware's `dotfiles` option now defaults to `"ignore"`. This is a change from Express 4, where dotfiles were served by default. As a result, files inside a directory that starts with a dot (`.`), such as `.well-known`, will no longer be accessible and will return a **404 Not Found** error. This can break functionality that depends on serving dot-directories, such as Android App Links, and Apple Universal Links.
476+
477+
Example of breaking code:
478+
479+
```js
480+
// v4
481+
app.use(express.static('public'))
482+
```
483+
484+
After migrating to Express 5, a request to `/.well-known/assetlinks.json` will result in a **404 Not Found**.
485+
486+
To fix this, serve specific dot-directories explicitly using the `dotfiles: "allow"` option:
487+
488+
```js
489+
// v5
490+
app.use('/.well-known', express.static('public/.well-known', { dotfiles: 'allow' }))
491+
app.use(express.static('public'))
492+
```
493+
494+
This approach allows you to safely serve only the intended dot-directories while keeping the default secure behavior for other dotfiles, which remain inaccessible.
495+
472496
<h3 id="app.listen">app.listen</h3>
473497

474498
In Express 5, the `app.listen` method will invoke the user-provided callback function (if provided) when the server receives an error event. In Express 4, such errors would be thrown. This change shifts error-handling responsibility to the callback function in Express 5. If there is an error, it will be passed to the callback as an argument.

de/guide/using-middleware.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ redirect_from: " "
1010

1111
Express ist ein Weiterleitungs- und Middleware-Web-Framework, das selbst nur minimale Funktionalität aufweist: Eine Express-Anwendung besteht im Wesentlichen aus einer Reihe von Middlewarefunktionsaufrufen.
1212

13-
_Middlewarefunktionen_ sind Funktionen, die Zugriff auf das [Anforderungsobjekt](/{{ page.lang }}/4x/api.html#req) (`req`), das [Antwortobjekt](/{{ page.lang }}/4x/api.html#res) (`res`) und die nächste Middlewarefunktion im Anforderung/Antwort-Zyklus der Anwendung haben. Die nächste Middlewarefunktion wird im Allgemeinen durch die Variable `next` bezeichnet.
13+
_Middleware_ functions are functions that have access to the [request object](/{{ page.lang }}/5x/api.html#req) (`req`), the [response object](/{{ page.lang }}/5x/api.html#res) (`res`), and the next middleware function in the application's request-response cycle. Die nächste Middlewarefunktion wird im Allgemeinen durch die Variable `next` bezeichnet.
1414

1515
Über Middlewarefunktionen lassen sich die folgenden Tasks ausführen:
1616

@@ -34,7 +34,7 @@ Sie können auch eine Reihe von Middlewarefunktionen zusammen laden. Dadurch wir
3434

3535
<h2 id='middleware.application'>Middleware auf Anwendungsebene</h2>
3636

37-
Binden Sie Middleware auf Anwendungsebene zu einer Instanz des [Anwendungsobjekts](/{{ page.lang }}/4x/api.html#app), indem Sie die Funktionen `app.use()` und `app.METHOD()` verwenden. `METHOD` ist dabei die HTTP-Methode der Anforderung, die die Middlewarefunktion in Kleinschreibung verarbeitet (wie GET, PUT oder POST).
37+
Bind application-level middleware to an instance of the [app object](/{{ page.lang }}/5x/api.html#app) by using the `app.use()` and `app.METHOD()` functions, where `METHOD` is the HTTP method of the request that the middleware function handles (such as GET, PUT, or POST) in lowercase.
3838

3939
Dieses Beispiel zeigt eine Middlewarefunktion ohne Mountpfad. Die Funktion wird immer dann ausgeführt, wenn die Anwendung eine Anforderung erhält.
4040

@@ -248,9 +248,9 @@ Seit Version 4.x bestehen bei Express keine Abhängigkeiten zu [Connect](https:/
248248

249249
Die einzige integrierte Middlewarefunktion in Express ist `express.static`.
250250

251-
- [express.static](/en/4x/api.html#express.static) serves static assets such as HTML files, images, and so on.
252-
- [express.json](/en/4x/api.html#express.json) parses incoming requests with JSON payloads. **NOTE: Available with Express 4.16.0+**
253-
- [express.urlencoded](/en/4x/api.html#express.urlencoded) parses incoming requests with URL-encoded payloads. **NOTE: Available with Express 4.16.0+**
251+
- [express.static](/en/5x/api.html#express.static) serves static assets such as HTML files, images, and so on.
252+
- [express.json](/en/5x/api.html#express.json) parses incoming requests with JSON payloads. **NOTE: Available with Express 4.16.0+**
253+
- [express.urlencoded](/en/5x/api.html#express.urlencoded) parses incoming requests with URL-encoded payloads. **NOTE: Available with Express 4.16.0+**
254254

255255
<h2 id='middleware.third-party'>Middleware anderer Anbieter</h2>
256256

de/starter/basic-routing.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ app.get('/', (req, res) => {
3939
})
4040
```
4141

42-
Antworten Sie auf POST-Anforderungen auf die Weiterleitung zum Stammverzeichnis (`/`), der Homepage der Anwendung:
42+
Respond to a POST request on the root route (`/`), the application's home page:
4343

4444
```js
4545
app.post('/', (req, res) => {
@@ -65,4 +65,4 @@ app.delete('/user', (req, res) => {
6565

6666
Details zum Thema Routing finden Sie in der entsprechenden [Routinganleitung](/{{ page.lang }}/guide/routing.html).
6767

68-
### [Previous: Express application generator ](/{{ page.lang }}/starter/generator.html)&nbsp;&nbsp;&nbsp;&nbsp;[Next: Serving static files in Express ](/{{ page.lang }}/starter/static-files.html)
68+
### [Previous: Express application generator ](/{{ page.lang }}/starter/generator.html)&nbsp;&nbsp;&nbsp;&nbsp;[Next: Serving static files in Express ](/{{ page.lang }}/starter/static-files.html)

en/guide/using-middleware.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ redirect_from: "/guide/using-middleware.html"
1010

1111
Express is a routing and middleware web framework that has minimal functionality of its own: An Express application is essentially a series of middleware function calls.
1212

13-
_Middleware_ functions are functions that have access to the [request object](/{{ page.lang }}/4x/api.html#req) (`req`), the [response object](/{{ page.lang }}/4x/api.html#res) (`res`), and the next middleware function in the application's request-response cycle. The next middleware function is commonly denoted by a variable named `next`.
13+
_Middleware_ functions are functions that have access to the [request object](/{{ page.lang }}/5x/api.html#req) (`req`), the [response object](/{{ page.lang }}/5x/api.html#res) (`res`), and the next middleware function in the application's request-response cycle. The next middleware function is commonly denoted by a variable named `next`.
1414

1515
Middleware functions can perform the following tasks:
1616

@@ -34,7 +34,7 @@ You can also load a series of middleware functions together, which creates a sub
3434

3535
<h2 id='middleware.application'>Application-level middleware</h2>
3636

37-
Bind application-level middleware to an instance of the [app object](/{{ page.lang }}/4x/api.html#app) by using the `app.use()` and `app.METHOD()` functions, where `METHOD` is the HTTP method of the request that the middleware function handles (such as GET, PUT, or POST) in lowercase.
37+
Bind application-level middleware to an instance of the [app object](/{{ page.lang }}/5x/api.html#app) by using the `app.use()` and `app.METHOD()` functions, where `METHOD` is the HTTP method of the request that the middleware function handles (such as GET, PUT, or POST) in lowercase.
3838

3939
This example shows a middleware function with no mount path. The function is executed every time the app receives a request.
4040

@@ -249,9 +249,10 @@ functions that were previously included with Express are now in separate modules
249249

250250
Express has the following built-in middleware functions:
251251

252-
- [express.static](/en/4x/api.html#express.static) serves static assets such as HTML files, images, and so on.
253-
- [express.json](/en/4x/api.html#express.json) parses incoming requests with JSON payloads. **NOTE: Available with Express 4.16.0+**
254-
- [express.urlencoded](/en/4x/api.html#express.urlencoded) parses incoming requests with URL-encoded payloads. **NOTE: Available with Express 4.16.0+**
252+
- [express.static](/en/5x/api.html#express.static) serves static assets such as HTML files, images, and so on.
253+
- [express.json](/en/5x/api.html#express.json) parses incoming requests with JSON payloads. **NOTE: Available with Express 4.16.0+**
254+
- [express.urlencoded](/en/5x/api.html#express.urlencoded) parses incoming requests with URL-encoded payloads. **NOTE: Available with Express 4.16.0+**
255+
gh-pages
255256

256257
Here is an example of using the `express.json` middleware with a custom limit:
257258

es/guide/migrating-5.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ You can find the list of available codemods [here](https://github.com/expressjs/
6666
<li><a href="#path-syntax">Path route matching syntax</a></li>
6767
<li><a href="#rejected-promises">Rejected promises handled from middleware and handlers</a></li>
6868
<li><a href="#express.urlencoded">express.urlencoded</a></li>
69+
<li><a href="#express.static.dotfiles">express.static dotfiles</a></li>
6970
<li><a href="#app.listen">app.listen</a></li>
7071
<li><a href="#app.router">app.router</a></li>
7172
<li><a href="#req.body">req.body</a></li>
@@ -469,6 +470,29 @@ Details of how Express handles errors is covered in the [error handling document
469470

470471
The `express.urlencoded` method makes the `extended` option `false` by default.
471472

473+
<h3 id="express.static.dotfiles">express.static dotfiles</h3>
474+
475+
In Express 5, the `express.static` middleware's `dotfiles` option now defaults to `"ignore"`. This is a change from Express 4, where dotfiles were served by default. As a result, files inside a directory that starts with a dot (`.`), such as `.well-known`, will no longer be accessible and will return a **404 Not Found** error. This can break functionality that depends on serving dot-directories, such as Android App Links, and Apple Universal Links.
476+
477+
Example of breaking code:
478+
479+
```js
480+
// v4
481+
app.use(express.static('public'))
482+
```
483+
484+
After migrating to Express 5, a request to `/.well-known/assetlinks.json` will result in a **404 Not Found**.
485+
486+
To fix this, serve specific dot-directories explicitly using the `dotfiles: "allow"` option:
487+
488+
```js
489+
// v5
490+
app.use('/.well-known', express.static('public/.well-known', { dotfiles: 'allow' }))
491+
app.use(express.static('public'))
492+
```
493+
494+
This approach allows you to safely serve only the intended dot-directories while keeping the default secure behavior for other dotfiles, which remain inaccessible.
495+
472496
<h3 id="app.listen">app.listen</h3>
473497

474498
In Express 5, the `app.listen` method will invoke the user-provided callback function (if provided) when the server receives an error event. In Express 4, such errors would be thrown. This change shifts error-handling responsibility to the callback function in Express 5. If there is an error, it will be passed to the callback as an argument.

0 commit comments

Comments
 (0)