You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: de/guide/migrating-5.md
+44-17Lines changed: 44 additions & 17 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -28,16 +28,16 @@ To help you migrate your express server, we have created a set of codemods that
28
28
Run the following command for run all the codemods available:
29
29
30
30
```sh
31
-
npx @expressjs/codemod upgrade
31
+
npx codemod@latest @expressjs/v5-migration-recipe
32
32
```
33
33
34
34
If you want to run a specific codemod, you can run the following command:
35
35
36
36
```sh
37
-
npx @expressjs/codemod name-of-the-codemod
37
+
npx codemod@latest @expressjs/name-of-the-codemod
38
38
```
39
39
40
-
You can find the list of available codemods [here](https://github.com/expressjs/codemod?tab=readme-ov-file#available-codemods).
40
+
You can find the list of available codemods [here](https://codemod.link/express).
41
41
42
42
<h2id="changes">Änderungen in Express 5</h2>
43
43
@@ -96,16 +96,16 @@ Express 5 unterstützt die Funktion `app.del()` nicht mehr. Wenn Sie diese Funkt
96
96
97
97
Anfänglich wurde `del` statt `delete` verwendet, weil `delete` in JavaScript ein reserviertes Schlüsselwort ist. Ab ECMAScript 6 jedoch können `delete` und andere reservierte Schlüsselwörter legal als Eigenschaftsnamen verwendet werden.
98
98
99
-
{% capture codemod-deprecated-signatures %}
99
+
{% capture codemod-route-del-to-delete %}
100
100
You can replace the deprecated signatures with the following command:
101
101
102
102
```plain-text
103
-
npx @expressjs/codemod v4-deprecated-signatures
103
+
npx codemod@latest @expressjs/route-del-to-delete
104
104
```
105
105
106
106
{% endcapture %}
107
107
108
-
{% include admonitions/note.html content=codemod-deprecated-signatures %}
108
+
{% include admonitions/note.html content=codemod-route-del-to-delete %}
109
109
110
110
```js
111
111
// v4
@@ -137,7 +137,7 @@ Die folgenden Methodennamen wurden pluralisiert. In Express 4 wurde bei Verwendu
137
137
You can replace the deprecated signatures with the following command:
Express 5 unterstützt die Signatur `res.json(obj, status)` nicht mehr. Stattdessen müssen Sie den Status festlegen und diesen dann mit `res.json()`-Methoden wie dieser verketten: `res.status(status).json(obj)`.
211
211
212
-
{% include admonitions/note.html content=codemod-deprecated-signatures %}
212
+
{% capture codemod-status-send-order %}
213
+
You can replace the deprecated signatures with the following command:
214
+
215
+
```plain-text
216
+
npx codemod@latest @expressjs/status-send-order
217
+
```
218
+
219
+
{% endcapture %}
220
+
221
+
{% include admonitions/note.html content=codemod-status-send-order %}
Express 5 unterstützt die Signatur `res.jsonp(obj, status)` nicht mehr. Stattdessen müssen Sie den Status festlegen und diesen dann mit `res.jsonp()`-Methoden wie dieser verketten: `res.status(status).jsonp(obj)`.
229
238
230
-
{% include admonitions/note.html content=codemod-deprecated-signatures %}
239
+
{% include admonitions/note.html content=codemod-status-send-order %}
Express 5 unterstützt die Signatur `res.send(obj, status)` nicht mehr. Stattdessen müssen Sie den Status festlegen und diesen dann mit `res.send()`-Methoden wie dieser verketten: `res.status(status).send(obj)`.
247
256
248
-
{% include admonitions/note.html content=codemod-deprecated-signatures %}
257
+
{% capture codemod-redirect-arg-order %}
258
+
You can replace the deprecated signatures with the following command:
259
+
260
+
```plain-text
261
+
npx codemod@latest @expressjs/redirect-arg-order
262
+
```
263
+
264
+
{% endcapture %}
265
+
266
+
{% include admonitions/note.html content=codemod-redirect-arg-order %}
Express 5 no longer supports the magic string `back` in the `res.redirect()` and `res.location()` methods. Instead, use the `req.get('Referrer') || '/'` value to redirect back to the previous page. In Express 4, the `res.redirect('back')` and `res.location('back')` methods were deprecated.
265
283
266
-
{% capture codemod-magic-redirect %}
284
+
{% capture codemod-back-redirect-deprecated %}
267
285
You can replace the deprecated signatures with the following command:
Express 5 no longer supports the signature `res.send(obj, status)`. Instead, set the status and then chain it to the `res.send()` method like this: `res.status(status).send(obj)`.
292
310
293
-
{% include admonitions/note.html content=codemod-deprecated-signatures %}
311
+
{% include admonitions/note.html content=codemod-status-send-order %}
Express 5 unterstützt die Signatur <code>res.send(<em>status</em>)</code>, nicht mehr, wobei _`status`_ für eine Zahl steht. Verwenden Sie stattdessen die Funktion `res.sendStatus(statusCode)`, mit der der Statuscode für den HTTP-Antwort-Header festgelegt und die Textversion des Codes gesendet wird: "Not Found" (Nicht gefunden), "Internal Server Error" (Interner Serverfehler) usw.
310
328
Wenn Sie eine Zahl senden und hierfür die Funktion `res.send()` verwenden müssen, müssen Sie die Zahl in Anführungszeichen setzen, um diese in eine Zeichenfolge zu konvertieren. Dadurch interpretiert Express diese Zahl nicht als Versuch, die nicht mehr unterstützte alte Signatur zu verwenden.
311
329
312
-
{% include admonitions/note.html content=codemod-deprecated-signatures %}
330
+
{% include admonitions/note.html content=codemod-status-send-order %}
313
331
314
332
```js
315
333
// v4
@@ -336,7 +354,16 @@ Die Funktion `res.sendfile()` wurde durch eine Version in Camel-Schreibweise von
336
354
- Font files (.woff): now "font/woff" instead of "application/font-woff"
337
355
- SVG files (.svg): now "image/svg+xml" instead of "application/svg+xml"
338
356
339
-
{% include admonitions/note.html content=codemod-deprecated-signatures %}
357
+
{% capture codemod-camelcase-sendfile %}
358
+
You can replace the deprecated signatures with the following command:
359
+
360
+
```plain-text
361
+
npx codemod@latest @expressjs/camelcase-sendfile
362
+
```
363
+
364
+
{% endcapture %}
365
+
366
+
{% include admonitions/note.html content=codemod-camelcase-sendfile %}
Copy file name to clipboardExpand all lines: es/guide/migrating-5.md
+44-17Lines changed: 44 additions & 17 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -28,16 +28,16 @@ To help you migrate your express server, we have created a set of codemods that
28
28
Run the following command for run all the codemods available:
29
29
30
30
```sh
31
-
npx @expressjs/codemod upgrade
31
+
npx codemod@latest @expressjs/v5-migration-recipe
32
32
```
33
33
34
34
If you want to run a specific codemod, you can run the following command:
35
35
36
36
```sh
37
-
npx @expressjs/codemod name-of-the-codemod
37
+
npx codemod@latest @expressjs/name-of-the-codemod
38
38
```
39
39
40
-
You can find the list of available codemods [here](https://github.com/expressjs/codemod?tab=readme-ov-file#available-codemods).
40
+
You can find the list of available codemods [here](https://codemod.link/express).
41
41
42
42
<h2id="changes">Changes in Express 5</h2>
43
43
@@ -96,16 +96,16 @@ Express 5 ya no da soporte a la función `app.del()`. Si utiliza esta función,
96
96
97
97
Inicialmente, se utilizaba `del` en lugar de `delete`, porque `delete` es una palabra clave reservada en JavaScript. No obstante, a partir de ECMAScript 6, `delete` y otras palabras clave reservadas pueden utilizarse correctamente como nombres de propiedad.
98
98
99
-
{% capture codemod-deprecated-signatures %}
99
+
{% capture codemod-route-del-to-delete %}
100
100
You can replace the deprecated signatures with the following command:
101
101
102
102
```plain-text
103
-
npx @expressjs/codemod v4-deprecated-signatures
103
+
npx codemod@latest @expressjs/route-del-to-delete
104
104
```
105
105
106
106
{% endcapture %}
107
107
108
-
{% include admonitions/note.html content=codemod-deprecated-signatures %}
108
+
{% include admonitions/note.html content=codemod-route-del-to-delete %}
109
109
110
110
```js
111
111
// v4
@@ -137,7 +137,7 @@ Los siguientes nombres de métodos se han pluralizado. En Express 4, el uso de l
137
137
You can replace the deprecated signatures with the following command:
Express 5 ya no da soporte a la firma `res.json(obj, status)`. En su lugar, establezca el estado y encadénelo al método `res.json()` de la siguiente manera: `res.status(status).json(obj)`.
211
211
212
-
{% include admonitions/note.html content=codemod-deprecated-signatures %}
212
+
{% capture codemod-status-send-order %}
213
+
You can replace the deprecated signatures with the following command:
214
+
215
+
```plain-text
216
+
npx codemod@latest @expressjs/status-send-order
217
+
```
218
+
219
+
{% endcapture %}
220
+
221
+
{% include admonitions/note.html content=codemod-status-send-order %}
Express 5 ya no da soporte a la firma `res.jsonp(obj, status)`. En su lugar, establezca el estado y encadénelo al método `res.jsonp()` de la siguiente manera: `res.status(status).jsonp(obj)`.
229
238
230
-
{% include admonitions/note.html content=codemod-deprecated-signatures %}
239
+
{% include admonitions/note.html content=codemod-status-send-order %}
Express 5 ya no da soporte a la firma `res.send(obj, status)`. En su lugar, establezca el estado y encadénelo al método `res.send()` de la siguiente manera: `res.status(status).send(obj)`.
247
256
248
-
{% include admonitions/note.html content=codemod-deprecated-signatures %}
257
+
{% capture codemod-redirect-arg-order %}
258
+
You can replace the deprecated signatures with the following command:
259
+
260
+
```plain-text
261
+
npx codemod@latest @expressjs/redirect-arg-order
262
+
```
263
+
264
+
{% endcapture %}
265
+
266
+
{% include admonitions/note.html content=codemod-redirect-arg-order %}
Express 5 no longer supports the magic string `back` in the `res.redirect()` and `res.location()` methods. Instead, use the `req.get('Referrer') || '/'` value to redirect back to the previous page. In Express 4, the `res.redirect('back')` and `res.location('back')` methods were deprecated.
265
283
266
-
{% capture codemod-magic-redirect %}
284
+
{% capture codemod-back-redirect-deprecated %}
267
285
You can replace the deprecated signatures with the following command:
Express 5 no longer supports the signature `res.send(obj, status)`. Instead, set the status and then chain it to the `res.send()` method like this: `res.status(status).send(obj)`.
292
310
293
-
{% include admonitions/note.html content=codemod-deprecated-signatures %}
311
+
{% include admonitions/note.html content=codemod-status-send-order %}
Express 5 ya no da soporte a la firma <code>res.send(<em>status</em>)</code>, donde _`status`_ es un número. En su lugar, utilice la función `res.sendStatus(statusCode)`, que establece el código de estado de la cabecera de respuesta HTTP y envía la versión de texto del código: "Not Found", "Internal Server Error", etc.
310
328
Si necesita enviar un número utilizando la función `res.send()`, escríbalo entre comillas para convertirlo en una serie, para que Express no lo interprete como un intento de utilizar la firma antigua no soportada.
311
329
312
-
{% include admonitions/note.html content=codemod-deprecated-signatures %}
330
+
{% include admonitions/note.html content=codemod-status-send-order %}
313
331
314
332
```js
315
333
// v4
@@ -336,7 +354,16 @@ La función `res.sendfile()` se ha sustituido por una versión de la función `r
336
354
- Font files (.woff): now "font/woff" instead of "application/font-woff"
337
355
- SVG files (.svg): now "image/svg+xml" instead of "application/svg+xml"
338
356
339
-
{% include admonitions/note.html content=codemod-deprecated-signatures %}
357
+
{% capture codemod-camelcase-sendfile %}
358
+
You can replace the deprecated signatures with the following command:
359
+
360
+
```plain-text
361
+
npx codemod@latest @expressjs/camelcase-sendfile
362
+
```
363
+
364
+
{% endcapture %}
365
+
366
+
{% include admonitions/note.html content=codemod-camelcase-sendfile %}
0 commit comments