Skip to content

Commit

Permalink
chore: add code example
Browse files Browse the repository at this point in the history
Co-authored-by: M. Heide <[email protected]>
  • Loading branch information
dpopp07 and heidemn-faro authored Dec 4, 2024
1 parent a973223 commit ae63d87
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions en/guide/migrating-5.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,16 @@ The `express.urlencoded` method makes the `extended` option `false` by default.
<h4 id="app.listen">app.listen</h4>

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) {

Check failure on line 170 in en/guide/migrating-5.md

View workflow job for this annotation

GitHub Actions / test

Unexpected tab character

Check failure on line 170 in en/guide/migrating-5.md

View workflow job for this annotation

GitHub Actions / test

Expected indentation of 2 spaces but found 1 tab
throw error; // e.g. EADDRINUSE

Check failure on line 171 in en/guide/migrating-5.md

View workflow job for this annotation

GitHub Actions / test

Unexpected tab character

Check failure on line 171 in en/guide/migrating-5.md

View workflow job for this annotation

GitHub Actions / test

Expected indentation of 4 spaces but found 2 tabs

Check failure on line 171 in en/guide/migrating-5.md

View workflow job for this annotation

GitHub Actions / test

Extra semicolon
}

Check failure on line 172 in en/guide/migrating-5.md

View workflow job for this annotation

GitHub Actions / test

Unexpected tab character

Check failure on line 172 in en/guide/migrating-5.md

View workflow job for this annotation

GitHub Actions / test

Expected indentation of 2 spaces but found 1 tab
console.log('Listening on ' + JSON.stringify(server.address()));

Check failure on line 173 in en/guide/migrating-5.md

View workflow job for this annotation

GitHub Actions / test

Unexpected tab character

Check failure on line 173 in en/guide/migrating-5.md

View workflow job for this annotation

GitHub Actions / test

Expected indentation of 2 spaces but found 1 tab

Check failure on line 173 in en/guide/migrating-5.md

View workflow job for this annotation

GitHub Actions / test

Unexpected string concatenation
});
```

<h4 id="app.router">app.router</h4>

Expand Down

0 comments on commit ae63d87

Please sign in to comment.