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
* update tables in 5.x for consistency in design
* update tables in 4.x for consistency in design
* remove content overflow for mobile devices
* remove inline padding from main conatent
---------
Co-authored-by: Sebastian Beltran <bjohansebas@gmail.com>
Copy file name to clipboardExpand all lines: _includes/api/en/4x/express.json.md
+4Lines changed: 4 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -26,6 +26,8 @@ For example, `req.body.foo.toString()` may fail in multiple ways, for example
26
26
function and instead a string or other user-input.
27
27
</div>
28
28
29
+
<divclass="table-scroller"markdown="1">
30
+
29
31
The following table describes the properties of the optional `options` object.
30
32
31
33
| Property | Description | Type | Default |
@@ -36,3 +38,5 @@ The following table describes the properties of the optional `options` object.
36
38
|`strict`| Enables or disables only accepting arrays and objects; when disabled will accept anything `JSON.parse` accepts. | Boolean |`true`|
37
39
|`type`| This is used to determine what media type the middleware will parse. This option can be a string, array of strings, or a function. If not a function, `type` option is passed directly to the [type-is](https://www.npmjs.org/package/type-is#readme) library and this can be an extension name (like `json`), a mime type (like `application/json`), or a mime type with a wildcard (like `*/*` or `*/json`). If a function, the `type` option is called as `fn(req)` and the request is parsed if it returns a truthy value. | Mixed |`"application/json"`|
38
40
|`verify`| This option, if supplied, is called as `verify(req, res, buf, encoding)`, where `buf` is a `Buffer` of the raw request body and `encoding` is the encoding of the request. The parsing can be aborted by throwing an error. | Function |`undefined`|
|`inflate`| Enables or disables handling deflated (compressed) bodies; when disabled, deflated bodies are rejected. | Boolean |`true`|
34
36
|`limit`| Controls the maximum request body size. If this is a number, then the value specifies the number of bytes; if it is a string, the value is passed to the [bytes](https://www.npmjs.com/package/bytes) library for parsing. | Mixed |`"100kb"`|
35
37
|`type`| This is used to determine what media type the middleware will parse. This option can be a string, array of strings, or a function. If not a function, `type` option is passed directly to the [type-is](https://www.npmjs.org/package/type-is#readme) library and this can be an extension name (like `bin`), a mime type (like `application/octet-stream`), or a mime type with a wildcard (like `*/*` or `application/*`). If a function, the `type` option is called as `fn(req)` and the request is parsed if it returns a truthy value. | Mixed |`"application/octet-stream"`|
36
38
|`verify`| This option, if supplied, is called as `verify(req, res, buf, encoding)`, where `buf` is a `Buffer` of the raw request body and `encoding` is the encoding of the request. The parsing can be aborted by throwing an error. | Function |`undefined`|
|`dotfiles`| Determines how dotfiles (files or directories that begin with a dot ".") are treated. <br/><br/>See [dotfiles](#dotfiles) below. | String |`undefined`|
@@ -29,6 +31,8 @@ See also the [example below](#example.of.express.static).
29
31
|`redirect`| Redirect to trailing "/" when the pathname is a directory. | Boolean |`true`|
30
32
|`setHeaders`| Function for setting HTTP headers to serve with the file. <br/><br/>See [setHeaders](#setHeaders) below. | Function ||
31
33
34
+
</div>
35
+
32
36
For more information, see [Serving static files in Express](/starter/static-files.html).
33
37
and [Using middleware - Built-in middleware](/{{page.lang}}/guide/using-middleware.html#middleware.built-in).
|`defaultCharset`| Specify the default character set for the text content if the charset is not specified in the `Content-Type` header of the request. | String |`"utf-8"`|
34
36
|`inflate`| Enables or disables handling deflated (compressed) bodies; when disabled, deflated bodies are rejected. | Boolean |`true`|
35
37
|`limit`| Controls the maximum request body size. If this is a number, then the value specifies the number of bytes; if it is a string, the value is passed to the [bytes](https://www.npmjs.com/package/bytes) library for parsing. | Mixed |`"100kb"`|
36
38
|`type`| This is used to determine what media type the middleware will parse. This option can be a string, array of strings, or a function. If not a function, `type` option is passed directly to the [type-is](https://www.npmjs.org/package/type-is#readme) library and this can be an extension name (like `txt`), a mime type (like `text/plain`), or a mime type with a wildcard (like `*/*` or `text/*`). If a function, the `type` option is called as `fn(req)` and the request is parsed if it returns a truthy value. | Mixed |`"text/plain"`|
37
39
|`verify`| This option, if supplied, is called as `verify(req, res, buf, encoding)`, where `buf` is a `Buffer` of the raw request body and `encoding` is the encoding of the request. The parsing can be aborted by throwing an error. | Function |`undefined`|
|`extended`| This option allows to choose between parsing the URL-encoded data with the `querystring` library (when `false`) or the `qs` library (when `true`). The "extended" syntax allows for rich objects and arrays to be encoded into the URL-encoded format, allowing for a JSON-like experience with URL-encoded. For more information, please [see the qs library](https://www.npmjs.org/package/qs#readme). | Boolean |`true`|
@@ -37,3 +39,5 @@ The following table describes the properties of the optional `options` object.
37
39
|`parameterLimit`| This option controls the maximum number of parameters that are allowed in the URL-encoded data. If a request contains more parameters than this value, an error will be raised. | Number |`1000`|
38
40
|`type`| This is used to determine what media type the middleware will parse. This option can be a string, array of strings, or a function. If not a function, `type` option is passed directly to the [type-is](https://www.npmjs.org/package/type-is#readme) library and this can be an extension name (like `urlencoded`), a mime type (like `application/x-www-form-urlencoded`), or a mime type with a wildcard (like `*/x-www-form-urlencoded`). If a function, the `type` option is called as `fn(req)` and the request is parsed if it returns a truthy value. | Mixed |`"application/x-www-form-urlencoded"`|
39
41
|`verify`| This option, if supplied, is called as `verify(req, res, buf, encoding)`, where `buf` is a `Buffer` of the raw request body and `encoding` is the encoding of the request. The parsing can be aborted by throwing an error. | Function |`undefined`|
| `combine` | Boolean | Specify if overlapping & adjacent ranges should be combined, defaults to `false`. When `true`, ranges will be combined and returned as if they were specified that way in the header.
13
+
|`combine`| Boolean | Specify if overlapping & adjacent ranges should be combined, defaults to `false`. When `true`, ranges will be combined and returned as if they were specified that way in the header.|
14
+
15
+
</div>
12
16
13
17
An array of ranges will be returned or negative numbers indicating an error parsing.
| `domain` | String | Domain name for the cookie. Defaults to the domain name of the app.
10
-
| `encode` | Function | A synchronous function used for cookie value encoding. Defaults to `encodeURIComponent`.
11
-
| `expires` | Date | Expiry date of the cookie in GMT. If not specified or set to 0, creates a session cookie.
12
-
| `httpOnly` | Boolean | Flags the cookie to be accessible only by the web server.
13
-
| `maxAge` | Number | Convenient option for setting the expiry time relative to the current time in milliseconds.
14
-
| `path` | String | Path for the cookie. Defaults to "/".
15
-
| `partitioned` | Boolean | Indicates that the cookie should be stored using partitioned storage. See [Cookies Having Independent Partitioned State (CHIPS)](https://developer.mozilla.org/en-US/docs/Web/Privacy/Partitioned_cookies) for more details.
16
-
| `priority` | String | Value of the "Priority" **Set-Cookie** attribute.
17
-
| `secure` | Boolean | Marks the cookie to be used with HTTPS only.
18
-
| `signed` | Boolean | Indicates if the cookie should be signed.
19
-
| `sameSite` | Boolean or String | Value of the "SameSite" **Set-Cookie** attribute. More information at [https://tools.ietf.org/html/draft-ietf-httpbis-cookie-same-site-00#section-4.1.1](https://tools.ietf.org/html/draft-ietf-httpbis-cookie-same-site-00#section-4.1.1).
11
+
|`domain`| String | Domain name for the cookie. Defaults to the domain name of the app.|
12
+
|`encode`| Function | A synchronous function used for cookie value encoding. Defaults to `encodeURIComponent`.|
13
+
|`expires`| Date | Expiry date of the cookie in GMT. If not specified or set to 0, creates a session cookie.|
14
+
|`httpOnly`| Boolean | Flags the cookie to be accessible only by the web server.|
15
+
|`maxAge`| Number | Convenient option for setting the expiry time relative to the current time in milliseconds.|
16
+
|`path`| String | Path for the cookie. Defaults to "/".|
17
+
|`partitioned`| Boolean | Indicates that the cookie should be stored using partitioned storage. See [Cookies Having Independent Partitioned State (CHIPS)](https://developer.mozilla.org/en-US/docs/Web/Privacy/Partitioned_cookies) for more details.|
18
+
|`priority`| String | Value of the "Priority" **Set-Cookie** attribute.|
19
+
|`secure`| Boolean | Marks the cookie to be used with HTTPS only.|
20
+
|`signed`| Boolean | Indicates if the cookie should be signed.|
21
+
|`sameSite`| Boolean or String | Value of the "SameSite" **Set-Cookie** attribute. More information at [https://tools.ietf.org/html/draft-ietf-httpbis-cookie-same-site-00#section-4.1.1](https://tools.ietf.org/html/draft-ietf-httpbis-cookie-same-site-00#section-4.1.1).|
22
+
23
+
</div>
20
24
21
25
<divclass="doc-box doc-notice"markdown="1">
22
26
All `res.cookie()` does is set the HTTP `Set-Cookie` header with the options provided.
0 commit comments