Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/content/api/3x/api/response/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ description: An overview of the API response object in Express.js, detailing its
---

The `res` object is an enhanced version of Node's own response object
and supports all [built-in fields and methods](https://nodejs.org/api/http.html#http_class_http_serverresponse).
and supports all [built-in fields and methods](https://nodejs.org/api/http.html#class-httpserverresponse).

## Properties

Expand Down
6 changes: 3 additions & 3 deletions src/content/api/4x/api/application/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -630,7 +630,7 @@ app.get('/', function (req: Request, res: Response) {

Binds and listens for connections on the specified host and port, or starts a
UNIX socket and listens for connections on the given path. This method is
identical to Node's [http.Server.listen()](https://nodejs.org/api/http.html#http_server_listen).
identical to Node's [http.Server.listen()](https://nodejs.org/api/http.html#serverlisten).

If port is omitted or is 0, the operating system will assign an arbitrary unused
port, which is useful for cases like automated tasks (tests, etc.).
Expand Down Expand Up @@ -699,7 +699,7 @@ http.createServer(app).listen(80);
https.createServer(options, app).listen(443);
```

The `app.listen()` method returns an [http.Server](https://nodejs.org/api/http.html#http_class_http_server) object and (for HTTP) is a convenience method for the following:
The `app.listen()` method returns an [http.Server](https://nodejs.org/api/http.html#class-httpserver) object and (for HTTP) is a convenience method for the following:

```js
app.listen = function () {
Expand All @@ -710,7 +710,7 @@ app.listen = function () {

<Alert type="info">

All the forms of Node's [http.Server.listen()](https://nodejs.org/api/http.html#http_server_listen) method are in fact actually supported.
All the forms of Node's [http.Server.listen()](https://nodejs.org/api/http.html#serverlisten) method are in fact actually supported.

</Alert>

Expand Down
4 changes: 2 additions & 2 deletions src/content/api/4x/api/request/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ app.get('/user/:id', function (request: Request, response: Response) {
```

The `req` object is an enhanced version of Node's own request object
and supports all [built-in fields and methods](https://nodejs.org/api/http.html#http_class_http_incomingmessage).
and supports all [built-in fields and methods](https://nodejs.org/api/http.html#class-httpincomingmessage).

## Properties

Expand Down Expand Up @@ -358,7 +358,7 @@ app.use(function (req: Request, res: Response, next: NextFunction) {
<Alert type="alert">

`req.url` is not a native Express property, it is inherited from Node's [http
module](https://nodejs.org/api/http.html#http_message_url).
module](https://nodejs.org/api/http.html#messageurl).

</Alert>

Expand Down
4 changes: 2 additions & 2 deletions src/content/api/4x/api/response/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ app.get('/user/:id', function (request: Request, response: Response) {
```

The `res` object is an enhanced version of Node's own response object
and supports all [built-in fields and methods](https://nodejs.org/api/http.html#http_class_http_serverresponse).
and supports all [built-in fields and methods](https://nodejs.org/api/http.html#class-httpserverresponse).

## Properties

Expand Down Expand Up @@ -1192,7 +1192,7 @@ Aliased as `res.header(field [, value])`.
</Signature>

Sets the HTTP status for the response.
It is a chainable alias of Node's [response.statusCode](https://nodejs.org/api/http.html#http_response_statuscode).
It is a chainable alias of Node's [response.statusCode](https://nodejs.org/api/http.html#responsestatuscode).

```js
res.status(403).end();
Expand Down
6 changes: 3 additions & 3 deletions src/content/api/5x/api/application/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -656,7 +656,7 @@ app.get('/', (req: Request, res: Response) => {

Binds and listens for connections on the specified host and port, or starts a
UNIX socket and listens for connections on the given path. This method is
identical to Node's [http.Server.listen()](https://nodejs.org/api/http.html#http_server_listen).
identical to Node's [http.Server.listen()](https://nodejs.org/api/http.html#serverlisten).

If port is omitted or is 0, the operating system will assign an arbitrary unused
port, which is useful for cases like automated tasks (tests, etc.).
Expand Down Expand Up @@ -741,7 +741,7 @@ http.createServer(app).listen(80);
https.createServer(options, app).listen(443);
```

The `app.listen()` method returns an [http.Server](https://nodejs.org/api/http.html#http_class_http_server) object and (for HTTP) is a convenience method for the following:
The `app.listen()` method returns an [http.Server](https://nodejs.org/api/http.html#class-httpserver) object and (for HTTP) is a convenience method for the following:

```js
app.listen = function () {
Expand All @@ -753,7 +753,7 @@ app.listen = function () {
<Alert type="info">

All the forms of Node's
[http.Server.listen()](https://nodejs.org/api/http.html#http_server_listen) method are in fact
[http.Server.listen()](https://nodejs.org/api/http.html#serverlisten) method are in fact
actually supported.

</Alert>
Expand Down
4 changes: 2 additions & 2 deletions src/content/api/5x/api/request/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ app.get('/user/:id', (request: Request, response: Response) => {
```

The `req` object is an enhanced version of Node's own request object
and supports all [built-in fields and methods](https://nodejs.org/api/http.html#http_class_http_incomingmessage).
and supports all [built-in fields and methods](https://nodejs.org/api/http.html#class-httpincomingmessage).

## Properties

Expand Down Expand Up @@ -350,7 +350,7 @@ app.use((req: Request, res: Response, next: NextFunction) => {
<Alert type="alert">

`req.url` is not a native Express property, it is inherited from Node's [http
module](https://nodejs.org/api/http.html#http_message_url).
module](https://nodejs.org/api/http.html#messageurl).

</Alert>

Expand Down
4 changes: 2 additions & 2 deletions src/content/api/5x/api/response/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ app.get('/user/:id', (request: Request, response: Response) => {
```

The `res` object is an enhanced version of Node's own response object
and supports all [built-in fields and methods](https://nodejs.org/api/http.html#http_class_http_serverresponse).
and supports all [built-in fields and methods](https://nodejs.org/api/http.html#class-httpserverresponse).

## Properties

Expand Down Expand Up @@ -1078,7 +1078,7 @@ Aliased as `res.header(field [, value])`.
</Signature>

Sets the HTTP status for the response.
It is a chainable alias of Node's [response.statusCode](https://nodejs.org/api/http.html#http_response_statuscode).
It is a chainable alias of Node's [response.statusCode](https://nodejs.org/api/http.html#responsestatuscode).

```js
res.status(403).end();
Expand Down
2 changes: 1 addition & 1 deletion src/content/docs/en/4x/guide/debugging.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ $ node --inspect index.js

Then attach a debugging client, such as Chrome DevTools (open `chrome://inspect`), VS Code, or any other inspector-capable tool, to set breakpoints in your route handlers and middleware, step through code, and inspect variables.

If you need to debug something that happens during startup, use `--inspect-brk` instead, which pauses execution on the first line until a debugger attaches. See the [Node.js debugging guide](https://nodejs.org/en/learn/getting-started/debugging) for details.
If you need to debug something that happens during startup, use `--inspect-brk` instead, which pauses execution on the first line until a debugger attaches. See the [Node.js debugging guide](https://nodejs.org/learn/getting-started/debugging) for details.

## Debugging the HTTP layer

Expand Down
2 changes: 1 addition & 1 deletion src/content/docs/en/4x/guide/overriding-express-api.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ description: Discover how to customize and extend the Express.js API by overridi

import Alert from '@components/primitives/Alert/Alert.astro';

The Express API consists of various methods and properties on the request and response objects. These are inherited by prototype. There are two extension points for the Express API:
The Express API consists of various methods and properties on the [request](/api/request) and [response](/api/response) objects. These are inherited by prototype. There are two extension points for the Express API:

1. The global prototypes at `express.request` and `express.response`.
2. App-specific prototypes at `app.request` and `app.response`.
Expand Down
4 changes: 2 additions & 2 deletions src/content/docs/en/4x/guide/routing.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ app.post('/', (req: Request, res: Response) => {
Express supports methods that correspond to all HTTP request methods: `get`, `post`, and so on.
For a full list, see [app.METHOD](/api/application#appmethod).

There is a special routing method, `app.all()`, used to load middleware functions at a path for _all_ HTTP request methods. For example, the following handler is executed for requests to the route `"/secret"` whether using `GET`, `QUERY`, `POST`, `PUT`, `DELETE`, or any other HTTP request method supported in the [http module](https://nodejs.org/api/http.html#http_http_methods).
There is a special routing method, `app.all()`, used to load middleware functions at a path for _all_ HTTP request methods. For example, the following handler is executed for requests to the route `"/secret"` whether using `GET`, `QUERY`, `POST`, `PUT`, `DELETE`, or any other HTTP request method supported in the [http module](https://nodejs.org/api/http.html#httpmethods).

```js
app.all('/secret', (req, res, next) => {
Expand Down Expand Up @@ -555,7 +555,7 @@ app.get(

## Response methods

The methods on the response object (`res`) in the following table can send a response to the client, and terminate the request-response cycle. If none of these methods are called from a route handler, the client request will be left hanging.
The methods on the [response object](/api/response) (`res`) in the following table can send a response to the client, and terminate the request-response cycle. If none of these methods are called from a route handler, the client request will be left hanging.

| Method | Description |
| ----------------------------------------------- | ------------------------------------------------------------------------------------- |
Expand Down
4 changes: 2 additions & 2 deletions src/content/docs/en/4x/guide/writing-middleware.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ The middleware function `myLogger` simply prints a message, then passes on the r
### Middleware function requestTime

Next, we'll create a middleware function called "requestTime" and add a property called `requestTime`
to the request object.
to the [request object](/api/request).

<Alert type="alert">

Expand Down Expand Up @@ -419,7 +419,7 @@ functions.

</Alert>

Because you have access to the request object, the response object, the next middleware function in the stack, and the whole Node.js API, the possibilities with middleware functions are endless.
Because you have access to the [request object](/api/request), the [response object](/api/response), the next middleware function in the stack, and the whole [Node.js API](https://nodejs.org/api/), the possibilities with middleware functions are endless.

<ReadMore>

Expand Down
2 changes: 1 addition & 1 deletion src/content/docs/en/4x/starter/installing.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ non-erasable syntax (such as `enum`s, namespaces, and parameter properties) that
}
```

Write your application in TypeScript, annotating the request and response objects:
Write your application in TypeScript, annotating the [request](/api/request) and [response](/api/response) objects:

```ts title="src/app.ts"
import express, { type Express, type Request, type Response } from 'express';
Expand Down
2 changes: 1 addition & 1 deletion src/content/docs/en/5x/guide/debugging.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ $ node --inspect index.js

Then attach a debugging client, such as Chrome DevTools (open `chrome://inspect`), VS Code, or any other inspector-capable tool, to set breakpoints in your route handlers and middleware, step through code, and inspect variables.

If you need to debug something that happens during startup, use `--inspect-brk` instead, which pauses execution on the first line until a debugger attaches. See the [Node.js debugging guide](https://nodejs.org/en/learn/getting-started/debugging) for details.
If you need to debug something that happens during startup, use `--inspect-brk` instead, which pauses execution on the first line until a debugger attaches. See the [Node.js debugging guide](https://nodejs.org/learn/getting-started/debugging) for details.

## Debugging the HTTP layer

Expand Down
2 changes: 1 addition & 1 deletion src/content/docs/en/5x/guide/overriding-express-api.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ description: Discover how to customize and extend the Express.js API by overridi

import Alert from '@components/primitives/Alert/Alert.astro';

The Express API consists of various methods and properties on the request and response objects. These are inherited by prototype. There are two extension points for the Express API:
The Express API consists of various methods and properties on the [request](/api/request) and [response](/api/response) objects. These are inherited by prototype. There are two extension points for the Express API:

1. The global prototypes at `express.request` and `express.response`.
2. App-specific prototypes at `app.request` and `app.response`.
Expand Down
4 changes: 2 additions & 2 deletions src/content/docs/en/5x/guide/routing.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ app.post('/', (req: Request, res: Response) => {
Express supports methods that correspond to all HTTP request methods: `get`, `post`, and so on.
For a full list, see [app.METHOD](/api/application#appmethod).

There is a special routing method, `app.all()`, used to load middleware functions at a path for _all_ HTTP request methods. For example, the following handler is executed for requests to the route `"/secret"` whether using `GET`, `QUERY`, `POST`, `PUT`, `DELETE`, or any other HTTP request method supported in the [http module](https://nodejs.org/api/http.html#http_http_methods).
There is a special routing method, `app.all()`, used to load middleware functions at a path for _all_ HTTP request methods. For example, the following handler is executed for requests to the route `"/secret"` whether using `GET`, `QUERY`, `POST`, `PUT`, `DELETE`, or any other HTTP request method supported in the [http module](https://nodejs.org/api/http.html#httpmethods).

```js
app.all('/secret', (req, res, next) => {
Expand Down Expand Up @@ -537,7 +537,7 @@ app.get(

## Response methods

The methods on the response object (`res`) in the following table can send a response to the client, and terminate the request-response cycle. If none of these methods are called from a route handler, the client request will be left hanging.
The methods on the [response object](/api/response) (`res`) in the following table can send a response to the client, and terminate the request-response cycle. If none of these methods are called from a route handler, the client request will be left hanging.

| Method | Description |
| ----------------------------------------------- | ------------------------------------------------------------------------------------- |
Expand Down
4 changes: 2 additions & 2 deletions src/content/docs/en/5x/guide/writing-middleware.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ The middleware function `myLogger` simply prints a message, then passes on the r
### Middleware function requestTime

Next, we'll create a middleware function called "requestTime" and add a property called `requestTime`
to the request object.
to the [request object](/api/request).

<Alert type="alert">

Expand Down Expand Up @@ -392,7 +392,7 @@ functions.

</Alert>

Because you have access to the request object, the response object, the next middleware function in the stack, and the whole Node.js API, the possibilities with middleware functions are endless.
Because you have access to the [request object](/api/request), the [response object](/api/response), the next middleware function in the stack, and the whole [Node.js API](https://nodejs.org/api/), the possibilities with middleware functions are endless.

<ReadMore>

Expand Down
2 changes: 1 addition & 1 deletion src/content/docs/en/5x/starter/installing.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ non-erasable syntax (such as `enum`s, namespaces, and parameter properties) that
}
```

Write your application in TypeScript, annotating the request and response objects:
Write your application in TypeScript, annotating the [request](/api/request) and [response](/api/response) objects:

```ts title="src/app.ts"
import express, { type Express, type Request, type Response } from 'express';
Expand Down
4 changes: 2 additions & 2 deletions src/content/pages/en/advanced/best-practice-performance.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Synchronous functions and methods tie up the executing process until they return

Although Node and many modules provide synchronous and asynchronous versions of their functions, always use the asynchronous version in production. The only time when a synchronous function can be justified is upon initial startup.

You can use the `--trace-sync-io` command-line flag to print a warning and a stack trace whenever your application uses a synchronous API. Of course, you wouldn't want to use this in production, but rather to ensure that your code is ready for production. See the [node command-line options documentation](https://nodejs.org/api/cli.html#trace-sync-io) for more information.
You can use the `--trace-sync-io` command-line flag to print a warning and a stack trace whenever your application uses a synchronous API. Of course, you wouldn't want to use this in production, but rather to ensure that your code is ready for production. See the [node command-line options documentation](https://nodejs.org/api/cli.html#--trace-sync-io) for more information.

### Do logging correctly

Expand Down Expand Up @@ -167,7 +167,7 @@ app.post('/resize', async (req, res, next) => {

Here `resize-worker.js` simply exports the function to run in the pool, and piscina takes care of creating the workers, queueing tasks, and reusing threads across requests.

For more guidance on keeping the event loop responsive, including when offloading work is worth its communication costs, see [Don't Block the Event Loop](https://nodejs.org/en/learn/asynchronous-work/dont-block-the-event-loop) in the Node.js documentation.
For more guidance on keeping the event loop responsive, including when offloading work is worth its communication costs, see [Don't Block the Event Loop](https://nodejs.org/learn/asynchronous-work/dont-block-the-event-loop) in the Node.js documentation.

## Things to do in your environment / setup

Expand Down
Loading