diff --git a/en/guide/migrating-5.md b/en/guide/migrating-5.md index 87de5c59ce..ab9155cec0 100755 --- a/en/guide/migrating-5.md +++ b/en/guide/migrating-5.md @@ -163,6 +163,16 @@ The `express.urlencoded` method makes the `extended` option `false` by default.

app.listen

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. +Example: + +```js +const server = app.listen(8080, '0.0.0.0', (error) => { + if (error) { + throw error; // e.g. EADDRINUSE + } + console.log('Listening on ' + JSON.stringify(server.address())); +}); +```

app.router