Skip to content
Merged
2 changes: 1 addition & 1 deletion src/content/api/4x/api/application/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -560,7 +560,7 @@ app.get('title');

app.set('title', 'My Site');
app.get('title');
// => "My Site"
// => 'My Site'
```

### app.get()
Expand Down
22 changes: 11 additions & 11 deletions src/content/api/4x/api/request/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -671,17 +671,17 @@ list or array, the method returns the _best_ match (if any).
```js
// Accept: text/html
req.accepts('html');
// => "html"
// => 'html'

// Accept: text/*, application/json
req.accepts('html');
// => "html"
// => 'html'
req.accepts('text/html');
// => "text/html"
// => 'text/html'
req.accepts(['json', 'text']);
// => "json"
// => 'json'
req.accepts('application/json');
// => "application/json"
// => 'application/json'

// Accept: text/*, application/json
req.accepts('image/png');
Expand All @@ -690,7 +690,7 @@ req.accepts('png');

// Accept: text/*;q=.5, application/json
req.accepts(['html', 'json']);
// => "json"
// => 'json'
```

For more information, or if you have issues or concerns, see [accepts](https://github.com/expressjs/accepts).
Expand Down Expand Up @@ -856,10 +856,10 @@ The `Referrer` and `Referer` fields are interchangeable.

```js
req.get('Content-Type');
// => "text/plain"
// => 'text/plain'

req.get('content-type');
// => "text/plain"
// => 'text/plain'

req.get('Something');
// => undefined
Expand Down Expand Up @@ -943,15 +943,15 @@ Returns the value of param `name` when present.
```js
// ?name=tobi
req.param('name');
// => "tobi"
// => 'tobi'

// POST name=tobi
req.param('name');
// => "tobi"
// => 'tobi'

// /user/tobi for /user/:name
req.param('name');
// => "tobi"
// => 'tobi'
```

Lookup is performed in the following order:
Expand Down
2 changes: 1 addition & 1 deletion src/content/api/4x/api/response/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -572,7 +572,7 @@ The match is case-insensitive.

```js
res.get('Content-Type');
// => "text/plain"
// => 'text/plain'
```

### res.json()
Expand Down
2 changes: 1 addition & 1 deletion src/content/api/5x/api/application/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -585,7 +585,7 @@ app.get('title');

app.set('title', 'My Site');
app.get('title');
// => "My Site"
// => 'My Site'
```

### app.get()
Expand Down
36 changes: 18 additions & 18 deletions src/content/api/5x/api/request/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ contains cookies sent by the request. If the request contains no cookies, it def
```js
// Cookie: name=tj
console.dir(req.cookies.name);
// => "tj"
// => 'tj'
```

If the cookie has been signed, you have to use [req.signedCookies](#reqsignedcookies).
Expand Down Expand Up @@ -292,7 +292,7 @@ the value of this property is derived from the left-most entry in the

```js
console.dir(req.ip);
// => "127.0.0.1"
// => '127.0.0.1'
```

### req.ips
Expand Down Expand Up @@ -361,7 +361,7 @@ the "mounting" feature of [app.use()](/api/application/#appuse) will rewrite `re
```js
// GET /search?q=something
console.dir(req.originalUrl);
// => "/search?q=something"
// => '/search?q=something'
```

`req.originalUrl` is available both in middleware and router objects, and is a
Expand Down Expand Up @@ -398,7 +398,7 @@ This property is an object containing properties mapped to the [named route "par
```js
// GET /user/tj
console.dir(req.params.name);
// => "tj"
// => 'tj'
```

Properties corresponding to wildcard parameters are arrays containing separate path segments split on `/`:
Expand Down Expand Up @@ -433,7 +433,7 @@ When you use a regular expression for the route definition, capture groups are p
app.use(/^\/file\/(.*)$/, (req, res) => {
// GET /file/javascripts/jquery.js
console.dir(req.params[0]);
// => "javascripts/jquery.js"
// => 'javascripts/jquery.js'
});
```

Expand All @@ -443,7 +443,7 @@ import { type Request, type Response } from 'express';
app.use(/^\/file\/(.*)$/, (req: Request, res: Response) => {
// GET /file/javascripts/jquery.js
console.dir(req.params[0]);
// => "javascripts/jquery.js"
// => 'javascripts/jquery.js'
});
```

Expand All @@ -468,7 +468,7 @@ Contains the path part of the request URL.
```js
// example.com/users?sort=desc
console.dir(req.path);
// => "/users"
// => '/users'
```

<Alert type="info">
Expand All @@ -490,7 +490,7 @@ This header can be set by the client or by the proxy.

```js
console.dir(req.protocol);
// => "http"
// => 'http'
```

### req.query
Expand Down Expand Up @@ -637,7 +637,7 @@ If no signed cookies are sent, the property defaults to `{}`.
```js
// Cookie: user=tobi.CP7AWaXDfAKIRfH49dQzKJx7sKzzSoPq7/AcBBRVwlI3
console.dir(req.signedCookies.user);
// => "tobi"
// => 'tobi'
```

For more information, issues, or concerns, see [cookie-parser](https://github.com/expressjs/cookie-parser).
Expand All @@ -663,7 +663,7 @@ An array of subdomains in the domain name of the request.
```js
// Host: "tobi.ferrets.example.com"
console.dir(req.subdomains);
// => ["ferrets", "tobi"]
// => ['ferrets', 'tobi']
```

The application property `subdomain offset`, which defaults to 2, is used for determining the
Expand Down Expand Up @@ -708,17 +708,17 @@ list or array, the method returns the _best_ match (if any).
```js
// Accept: text/html
req.accepts('html');
// => "html"
// => 'html'

// Accept: text/*, application/json
req.accepts('html');
// => "html"
// => 'html'
req.accepts('text/html');
// => "text/html"
// => 'text/html'
req.accepts(['json', 'text']);
// => "json"
// => 'json'
req.accepts('application/json');
// => "application/json"
// => 'application/json'

// Accept: text/*, application/json
req.accepts('image/png');
Expand All @@ -727,7 +727,7 @@ req.accepts('png');

// Accept: text/*;q=.5, application/json
req.accepts(['html', 'json']);
// => "json"
// => 'json'
```

For more information, or if you have issues or concerns, see [accepts](https://github.com/expressjs/accepts).
Expand Down Expand Up @@ -832,10 +832,10 @@ The `Referrer` and `Referer` fields are interchangeable.

```js
req.get('Content-Type');
// => "text/plain"
// => 'text/plain'

req.get('content-type');
// => "text/plain"
// => 'text/plain'

req.get('Something');
// => undefined
Expand Down
2 changes: 1 addition & 1 deletion src/content/api/5x/api/response/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,7 @@ The match is case-insensitive.

```js
res.get('Content-Type');
// => "text/plain"
// => 'text/plain'
```

### res.json()
Expand Down
Loading