diff --git a/_includes/api/en/4x/app-METHOD.md b/_includes/api/en/4x/app-METHOD.md index 94c82a24..c526a04d 100644 --- a/_includes/api/en/4x/app-METHOD.md +++ b/_includes/api/en/4x/app-METHOD.md @@ -10,39 +10,37 @@ PUT, POST, and so on, in lowercase. Thus, the actual methods are `app.get()`, Express supports the following routing methods corresponding to the HTTP methods of the same names: - - - - - - -
-* `checkout` -* `copy` -* `delete` -* `get` -* `head` -* `lock` -* `merge` -* `mkactivity` - -* `mkcol` -* `move` -* `m-search` -* `notify` -* `options` -* `patch` -* `post` - -* `purge` -* `put` -* `report` -* `search` -* `subscribe` -* `trace` -* `unlock` -* `unsubscribe` -
+
+ + + +
The API documentation has explicit entries only for the most popular HTTP methods `app.get()`, `app.post()`, `app.put()`, and `app.delete()`. diff --git a/_includes/api/en/4x/app-settings.md b/_includes/api/en/4x/app-settings.md index 35653644..1b5a2610 100644 --- a/_includes/api/en/4x/app-settings.md +++ b/_includes/api/en/4x/app-settings.md @@ -9,8 +9,15 @@ Exceptions: Sub-apps will inherit the value of `trust proxy` even though it has Sub-apps will not inherit the value of `view cache` in production (when `NODE_ENV` is "production").
- - +
PropertyTypeDescriptionDefault
+ + + + + + + +
PropertyTypeDescriptionDefault
@@ -193,6 +200,7 @@ A custom query string parsing function will receive the complete query string, a
+
Options for `trust proxy` setting
@@ -201,7 +209,8 @@ A custom query string parsing function will receive the complete query string, a information.

- +
+
@@ -271,6 +280,7 @@ app.set('trust proxy', function (ip) {
TypeValue
+
Options for `etag` setting
@@ -285,7 +295,8 @@ The [express.static](#express.static) middleware ignores these settings. For more information, see its documentation.

- +
+
diff --git a/_includes/api/en/4x/app-use.md b/_includes/api/en/4x/app-use.md index 473b9f43..52ea12ff 100644 --- a/_includes/api/en/4x/app-use.md +++ b/_includes/api/en/4x/app-use.md @@ -66,7 +66,7 @@ The following table provides some simple examples of valid `path` values for mounting middleware.
-
TypeValue
+
@@ -166,7 +166,7 @@ app.use(['/abcd', '/xyza', /\/lmn|\/pqr/], function (req, res, next) { The following table provides some simple examples of middleware functions that can be used as the `callback` argument to `app.use()`, `app.METHOD()`, and `app.all()`. -
+
@@ -282,6 +282,7 @@ app.use(mw1, [mw2, r1, r2], subApp)
+ Following are some examples of using the [express.static](/{{page.lang}}/guide/using-middleware.html#middleware.built-in) middleware in an Express app. diff --git a/_includes/api/en/4x/express.json.md b/_includes/api/en/4x/express.json.md index f7cb4b7c..ffc46019 100644 --- a/_includes/api/en/4x/express.json.md +++ b/_includes/api/en/4x/express.json.md @@ -26,6 +26,8 @@ For example, `req.body.foo.toString()` may fail in multiple ways, for example function and instead a string or other user-input. +
+ The following table describes the properties of the optional `options` object. | Property | Description | Type | Default | @@ -36,3 +38,5 @@ The following table describes the properties of the optional `options` object. | `strict` | Enables or disables only accepting arrays and objects; when disabled will accept anything `JSON.parse` accepts. | Boolean | `true` | | `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"` | | `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` | + +
\ No newline at end of file diff --git a/_includes/api/en/4x/express.raw.md b/_includes/api/en/4x/express.raw.md index 0177f8dd..cac172fb 100644 --- a/_includes/api/en/4x/express.raw.md +++ b/_includes/api/en/4x/express.raw.md @@ -28,9 +28,13 @@ that `req.body` is a `Buffer` before calling buffer methods is recommended. The following table describes the properties of the optional `options` object. +
+ | Property | Description | Type | Default | |-----------|-----------------------------------------------------------------------|-------------|-----------------| | `inflate` | Enables or disables handling deflated (compressed) bodies; when disabled, deflated bodies are rejected. | Boolean | `true` | | `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"` | | `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"` | | `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` | + +
\ No newline at end of file diff --git a/_includes/api/en/4x/express.static.md b/_includes/api/en/4x/express.static.md index 065ecb27..b92c2d7b 100644 --- a/_includes/api/en/4x/express.static.md +++ b/_includes/api/en/4x/express.static.md @@ -16,6 +16,8 @@ to move on to the next middleware, allowing for stacking and fall-backs. The following table describes the properties of the `options` object. See also the [example below](#example.of.express.static). +
+ | Property | Description | Type | Default | |---------------|-----------------------------------------------------------------------|-------------|-----------------| | `dotfiles` | Determines how dotfiles (files or directories that begin with a dot ".") are treated.

See [dotfiles](#dotfiles) below. | String | `undefined` | @@ -29,6 +31,8 @@ See also the [example below](#example.of.express.static). | `redirect` | Redirect to trailing "/" when the pathname is a directory. | Boolean | `true` | | `setHeaders` | Function for setting HTTP headers to serve with the file.

See [setHeaders](#setHeaders) below. | Function | | +
+ For more information, see [Serving static files in Express](/starter/static-files.html). and [Using middleware - Built-in middleware](/{{page.lang}}/guide/using-middleware.html#middleware.built-in). diff --git a/_includes/api/en/4x/express.text.md b/_includes/api/en/4x/express.text.md index 90364c6d..4d762427 100644 --- a/_includes/api/en/4x/express.text.md +++ b/_includes/api/en/4x/express.text.md @@ -28,6 +28,8 @@ that `req.body` is a string before calling string methods is recommended. The following table describes the properties of the optional `options` object. +
+ | Property | Description | Type | Default | |------------------|-----------------------------------------------------------------------|-------------|-----------------| | `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"` | @@ -35,3 +37,5 @@ The following table describes the properties of the optional `options` object. | `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"` | | `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"` | | `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` | + +
\ No newline at end of file diff --git a/_includes/api/en/4x/express.urlencoded.md b/_includes/api/en/4x/express.urlencoded.md index f20ae40e..7e1c7e47 100644 --- a/_includes/api/en/4x/express.urlencoded.md +++ b/_includes/api/en/4x/express.urlencoded.md @@ -29,6 +29,8 @@ function and instead a string or other user-input. The following table describes the properties of the optional `options` object. +
+ | Property | Description | Type | Default | |------------------|-----------------------------------------------------------------------|-------------|-----------------| | `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. | `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` | | `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"` | | `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` | + +
\ No newline at end of file diff --git a/_includes/api/en/4x/req-range.md b/_includes/api/en/4x/req-range.md index e6411c66..dbf2afeb 100644 --- a/_includes/api/en/4x/req-range.md +++ b/_includes/api/en/4x/req-range.md @@ -6,9 +6,13 @@ The `size` parameter is the maximum size of the resource. The `options` parameter is an object that can have the following properties. +
+ | Property | Type | Description | |-------------|-------------------------------------------------------------------------| -| `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. +| `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.| + +
An array of ranges will be returned or negative numbers indicating an error parsing. diff --git a/_includes/api/en/4x/res-cookie.md b/_includes/api/en/4x/res-cookie.md index 2cd8d32f..81477934 100644 --- a/_includes/api/en/4x/res-cookie.md +++ b/_includes/api/en/4x/res-cookie.md @@ -4,19 +4,23 @@ Sets cookie `name` to `value`. The `value` parameter may be a string or object The `options` parameter is an object that can have the following properties. +
+ | Property | Type | Description | |---------------|-------------------------------------------------------------------------| -| `domain` | String | Domain name for the cookie. Defaults to the domain name of the app. -| `encode` | Function | A synchronous function used for cookie value encoding. Defaults to `encodeURIComponent`. -| `expires` | Date | Expiry date of the cookie in GMT. If not specified or set to 0, creates a session cookie. -| `httpOnly` | Boolean | Flags the cookie to be accessible only by the web server. -| `maxAge` | Number | Convenient option for setting the expiry time relative to the current time in milliseconds. -| `path` | String | Path for the cookie. Defaults to "/". -| `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. -| `priority` | String | Value of the "Priority" **Set-Cookie** attribute. -| `secure` | Boolean | Marks the cookie to be used with HTTPS only. -| `signed` | Boolean | Indicates if the cookie should be signed. -| `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). +| `domain` | String | Domain name for the cookie. Defaults to the domain name of the app.| +| `encode` | Function | A synchronous function used for cookie value encoding. Defaults to `encodeURIComponent`.| +| `expires` | Date | Expiry date of the cookie in GMT. If not specified or set to 0, creates a session cookie.| +| `httpOnly` | Boolean | Flags the cookie to be accessible only by the web server.| +| `maxAge` | Number | Convenient option for setting the expiry time relative to the current time in milliseconds.| +| `path` | String | Path for the cookie. Defaults to "/".| +| `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.| +| `priority` | String | Value of the "Priority" **Set-Cookie** attribute.| +| `secure` | Boolean | Marks the cookie to be used with HTTPS only.| +| `signed` | Boolean | Indicates if the cookie should be signed.| +| `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).| + +
All `res.cookie()` does is set the HTTP `Set-Cookie` header with the options provided. diff --git a/_includes/api/en/4x/routing-args.html b/_includes/api/en/4x/routing-args.html index 4a3bc6fe..6dd9fe87 100644 --- a/_includes/api/en/4x/routing-args.html +++ b/_includes/api/en/4x/routing-args.html @@ -1,49 +1,55 @@ -

Arguments

+

Arguments

- - - - - - - - - - - - - - - - - -
Argument Description Default
path -The path for which the middleware function is invoked; can be any of: -
    -
  • A string representing a path.
  • -
  • A path pattern.
  • -
  • A regular expression pattern to match paths.
  • -
  • An array of combinations of any of the above.
  • -
- -For examples, see Path examples. -
'/' (root path)
callback -Callback functions; can be: -
    -
  • A middleware function.
  • -
  • A series of middleware functions (separated by commas).
  • -
  • An array of middleware functions.
  • -
  • A combination of all of the above.
  • -
-

-You can provide multiple callback functions that behave just like middleware, except -that these callbacks can invoke next('route') to bypass -the remaining route callback(s). You can use this mechanism to impose pre-conditions -on a route, then pass control to subsequent routes if there is no reason to proceed with the current route. -

-Since router and app implement the middleware interface, -you can use them as you would any other middleware function. -

-For examples, see Middleware callback function examples. -

-
None
+
+ + + + + + + + + + + + + + + + + + + + +
ArgumentDescriptionDefault
path + The path for which the middleware function is invoked; can be any of: +
    +
  • A string representing a path.
  • +
  • A path pattern.
  • +
  • A regular expression pattern to match paths.
  • +
  • An array of combinations of any of the above.
  • +
+ For examples, see Path examples. +
'/' (root path)
callback + Callback functions; can be: +
    +
  • A middleware function.
  • +
  • A series of middleware functions (separated by commas).
  • +
  • An array of middleware functions.
  • +
  • A combination of all of the above.
  • +
+

+ You can provide multiple callback functions that behave just like middleware, except + that these callbacks can invoke next('route') to bypass + the remaining route callback(s). You can use this mechanism to impose pre-conditions + on a route, then pass control to subsequent routes if there is no reason to proceed with the current route. +

+

+ Since router and app implement the middleware interface, + you can use them as you would any other middleware function. +

+

+ For examples, see Middleware callback function examples. +

+
None
+
\ No newline at end of file diff --git a/_includes/api/en/5x/app-METHOD.md b/_includes/api/en/5x/app-METHOD.md index 0c7cc6f1..c2a1c058 100644 --- a/_includes/api/en/5x/app-METHOD.md +++ b/_includes/api/en/5x/app-METHOD.md @@ -10,39 +10,37 @@ PUT, POST, and so on, in lowercase. Thus, the actual methods are `app.get()`, Express supports the following routing methods corresponding to the HTTP methods of the same names: - - - - - - -
-* `checkout` -* `copy` -* `delete` -* `get` -* `head` -* `lock` -* `merge` -* `mkactivity` - -* `mkcol` -* `move` -* `m-search` -* `notify` -* `options` -* `patch` -* `post` - -* `purge` -* `put` -* `report` -* `search` -* `subscribe` -* `trace` -* `unlock` -* `unsubscribe` -
+
+ + + +
The API documentation has explicit entries only for the most popular HTTP methods `app.get()`, `app.post()`, `app.put()`, and `app.delete()`. diff --git a/_includes/api/en/5x/app-settings.md b/_includes/api/en/5x/app-settings.md index 639c198a..3b8b8369 100644 --- a/_includes/api/en/5x/app-settings.md +++ b/_includes/api/en/5x/app-settings.md @@ -9,7 +9,7 @@ Exceptions: Sub-apps will inherit the value of `trust proxy` even though it has Sub-apps will not inherit the value of `view cache` in production (when `NODE_ENV` is "production").
- +
@@ -194,6 +194,7 @@ A custom query string parsing function will receive the complete query string, a
PropertyTypeDescriptionDefault
+
Options for `trust proxy` setting
@@ -202,7 +203,8 @@ A custom query string parsing function will receive the complete query string, a information.

- +
+
@@ -272,6 +274,7 @@ app.set('trust proxy', (ip) => {
TypeValue
+
Options for `etag` setting
@@ -286,7 +289,8 @@ The [express.static](#express.static) middleware ignores these settings. For more information, see its documentation.

- +
+
diff --git a/_includes/api/en/5x/app-use.md b/_includes/api/en/5x/app-use.md index 47501d52..c4806291 100644 --- a/_includes/api/en/5x/app-use.md +++ b/_includes/api/en/5x/app-use.md @@ -66,7 +66,7 @@ The following table provides some simple examples of valid `path` values for mounting middleware.
-
TypeValue
+
@@ -143,7 +143,8 @@ app.use(['/abcd', '/xyza', /\/lmn|\/pqr/], (req, res, next) => { The following table provides some simple examples of middleware functions that can be used as the `callback` argument to `app.use()`, `app.METHOD()`, and `app.all()`. -
+
+
@@ -258,6 +259,7 @@ app.use(mw1, [mw2, r1, r2], subApp)
+ Following are some examples of using the [express.static](/{{page.lang}}/guide/using-middleware.html#middleware.built-in) middleware in an Express app. diff --git a/_includes/api/en/5x/express.json.md b/_includes/api/en/5x/express.json.md index 2fd87c90..bc12042d 100644 --- a/_includes/api/en/5x/express.json.md +++ b/_includes/api/en/5x/express.json.md @@ -24,6 +24,8 @@ function and instead a string or other user-input. The following table describes the properties of the optional `options` object. +
+ | Property | Description | Type | Default | |---------------|-----------------------------------------------------------------------|-------------|-----------------| | `inflate` | Enables or disables handling deflated (compressed) bodies; when disabled, deflated bodies are rejected. | Boolean | `true` | @@ -32,3 +34,5 @@ The following table describes the properties of the optional `options` object. | `strict` | Enables or disables only accepting arrays and objects; when disabled will accept anything `JSON.parse` accepts. | Boolean | `true` | | `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"` | | `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` | + +
\ No newline at end of file diff --git a/_includes/api/en/5x/express.raw.md b/_includes/api/en/5x/express.raw.md index 0f478f7a..b20ff13e 100644 --- a/_includes/api/en/5x/express.raw.md +++ b/_includes/api/en/5x/express.raw.md @@ -24,9 +24,13 @@ that `req.body` is a `Buffer` before calling buffer methods is recommended. The following table describes the properties of the optional `options` object. +
+ | Property | Description | Type | Default | |-----------|-----------------------------------------------------------------------|-------------|-----------------| | `inflate` | Enables or disables handling deflated (compressed) bodies; when disabled, deflated bodies are rejected. | Boolean | `true` | | `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"` | | `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"` | | `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` | + +
\ No newline at end of file diff --git a/_includes/api/en/5x/express.static.md b/_includes/api/en/5x/express.static.md index d1c0d5b4..6914c500 100644 --- a/_includes/api/en/5x/express.static.md +++ b/_includes/api/en/5x/express.static.md @@ -14,6 +14,8 @@ to move on to the next middleware, allowing for stacking and fall-backs. The following table describes the properties of the `options` object. See also the [example below](#example.of.express.static). +
+ | Property | Description | Type | Default | |---------------|-----------------------------------------------------------------------|-------------|-----------------| | `dotfiles` | Determines how dotfiles (files or directories that begin with a dot ".") are treated.

See [dotfiles](#dotfiles) below. | String | "ignore"| @@ -27,6 +29,8 @@ See also the [example below](#example.of.express.static). | `redirect` | Redirect to trailing "/" when the pathname is a directory. | Boolean | `true` | | `setHeaders` | Function for setting HTTP headers to serve with the file.

See [setHeaders](#setHeaders) below. | Function | | +
+ For more information, see [Serving static files in Express](/starter/static-files.html). and [Using middleware - Built-in middleware](/{{page.lang}}/guide/using-middleware.html#middleware.built-in). diff --git a/_includes/api/en/5x/express.text.md b/_includes/api/en/5x/express.text.md index c41d4597..18223455 100644 --- a/_includes/api/en/5x/express.text.md +++ b/_includes/api/en/5x/express.text.md @@ -24,6 +24,8 @@ that `req.body` is a string before calling string methods is recommended. The following table describes the properties of the optional `options` object. +
+ | Property | Description | Type | Default | |------------------|-----------------------------------------------------------------------|-------------|-----------------| | `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"` | @@ -31,3 +33,5 @@ The following table describes the properties of the optional `options` object. | `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"` | | `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"` | | `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` | + +
\ No newline at end of file diff --git a/_includes/api/en/5x/express.urlencoded.md b/_includes/api/en/5x/express.urlencoded.md index 328c04f2..1eaf22ce 100644 --- a/_includes/api/en/5x/express.urlencoded.md +++ b/_includes/api/en/5x/express.urlencoded.md @@ -25,6 +25,8 @@ function and instead a string or other user-input. The following table describes the properties of the optional `options` object. +
+ | Property | Description | Type | Default | |------------------|-----------------------------------------------------------------------|-------------|-----------------| | `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 | `false` | @@ -33,3 +35,5 @@ The following table describes the properties of the optional `options` object. | `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` | | `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"` | | `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` | + +
\ No newline at end of file diff --git a/_includes/api/en/5x/req-range.md b/_includes/api/en/5x/req-range.md index 8ebce463..1444f8f8 100644 --- a/_includes/api/en/5x/req-range.md +++ b/_includes/api/en/5x/req-range.md @@ -6,9 +6,13 @@ The `size` parameter is the maximum size of the resource. The `options` parameter is an object that can have the following properties. +
+ | Property | Type | Description | |-------------|-------------------------------------------------------------------------| -| `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. +| `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.| + +
An array of ranges will be returned or negative numbers indicating an error parsing. diff --git a/_includes/api/en/5x/res-cookie.md b/_includes/api/en/5x/res-cookie.md index 3e91d649..c8ee380e 100644 --- a/_includes/api/en/5x/res-cookie.md +++ b/_includes/api/en/5x/res-cookie.md @@ -4,19 +4,23 @@ Sets cookie `name` to `value`. The `value` parameter may be a string or object The `options` parameter is an object that can have the following properties. +
+ | Property | Type | Description | |---------------|-------------------------------------------------------------------------| -| `domain` | String | Domain name for the cookie. Defaults to the domain name of the app. -| `encode` | Function | A synchronous function used for cookie value encoding. Defaults to `encodeURIComponent`. -| `expires` | Date | Expiry date of the cookie in GMT. If not specified or set to 0, creates a session cookie. -| `httpOnly` | Boolean | Flags the cookie to be accessible only by the web server. -| `maxAge` | Number | Convenient option for setting the expiry time relative to the current time in milliseconds. -| `path` | String | Path for the cookie. Defaults to "/". -| `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. -| `priority` | String | Value of the "Priority" **Set-Cookie** attribute. -| `secure` | Boolean | Marks the cookie to be used with HTTPS only. -| `signed` | Boolean | Indicates if the cookie should be signed. -| `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). +| `domain` | String | Domain name for the cookie. Defaults to the domain name of the app.| +| `encode` | Function | A synchronous function used for cookie value encoding. Defaults to `encodeURIComponent`.| +| `expires` | Date | Expiry date of the cookie in GMT. If not specified or set to 0, creates a session cookie.| +| `httpOnly` | Boolean | Flags the cookie to be accessible only by the web server.| +| `maxAge` | Number | Convenient option for setting the expiry time relative to the current time in milliseconds.| +| `path` | String | Path for the cookie. Defaults to "/".| +| `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.| +| `priority` | String | Value of the "Priority" **Set-Cookie** attribute.| +| `secure` | Boolean | Marks the cookie to be used with HTTPS only.| +| `signed` | Boolean | Indicates if the cookie should be signed.| +| `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).| + +
All `res.cookie()` does is set the HTTP `Set-Cookie` header with the options provided. diff --git a/_includes/api/en/5x/routing-args.html b/_includes/api/en/5x/routing-args.html index 7ad66fdb..bd7e504d 100644 --- a/_includes/api/en/5x/routing-args.html +++ b/_includes/api/en/5x/routing-args.html @@ -1,51 +1,58 @@ -

Arguments

+

Arguments

- - - - - - +
+
Argument Description Default
+ + + + + + + + + + + + + - - - - - - - - - - -
ArgumentDescriptionDefault
path + The path for which the middleware function is invoked. It can be any of the following: +
    +
  • A string representing a path.
  • +
  • A path pattern.
  • +
  • A regular expression pattern to match paths.
  • +
  • An array containing any combination of the above.
  • +
+ For examples, see Path examples. +
'/' (root path)
path -The path for which the middleware function is invoked; can be any of: -
    -
  • A string representing a path.
  • -
  • A path pattern.
  • -
  • A regular expression pattern to match paths.
  • -
  • An array of combinations of any of the above.
  • -
- -For examples, see Path examples. -
'/' (root path)
callback -Callback functions; can be: -
    -
  • A middleware function.
  • -
  • A series of middleware functions (separated by commas).
  • -
  • An array of middleware functions.
  • -
  • A combination of all of the above.
  • -
-

-You can provide multiple callback functions that behave just like middleware, except -that these callbacks can invoke next('route') to bypass -the remaining route callback(s). You can use this mechanism to impose pre-conditions -on a route, then pass control to subsequent routes if there is no reason to proceed with the current route. -

-When a callback function throws an error or returns a rejected promise, `next(err)` will be invoked automatically. -

-Since router and app implement the middleware interface, -you can use them as you would any other middleware function. -

-For examples, see Middleware callback function examples. -

-
None
+ + callback + + One or more callback functions. Accepted formats: + +

+ You may provide multiple callbacks that behave like middleware. These can call + next('route') to skip remaining callbacks for the current route. + This is useful for conditional routing logic. +

+

+ If a callback throws an error or returns a rejected promise, next(err) is invoked automatically. +

+

+ Since both router and app implement the middleware interface, + they can also be used as callback middleware. +

+

+ For examples, see Middleware callback function examples. +

+ + None + + + +
\ No newline at end of file diff --git a/css/style.css b/css/style.css index 28af91c7..86e124fe 100644 --- a/css/style.css +++ b/css/style.css @@ -9,6 +9,23 @@ body { margin: 0; padding: 0; color: var(--fg); + display: grid; + grid-template-areas: + 'header' + 'content' + 'footer' +} + +header { + grid-area: header; +} + +.content { + grid-area: content; +} + +footer { + grid-area: footer; } body.no-scroll{ @@ -75,10 +92,6 @@ main.home { display: flex; } -.en-doc #home-content { - margin-top: 150px; -} - .non-en-doc:has(#i18n-notice-box.hidden) #home-content { margin-top: 150px; } @@ -157,13 +170,13 @@ main.home { } .content { - margin: 153px 0 7%; display: flex; flex-direction: row-reverse; + padding-inline-start: 1rem; + margin-block-start: 3.5rem; } .content main { - padding-inline: 16px; max-width: 900px; margin-inline: auto; } @@ -315,17 +328,12 @@ a { } header { - position: fixed; - top: 0; - left: 0; background: var(--card-bg); - width: 100%; height: 57px; display: flex; align-items: center; justify-content: space-between; - padding-inline: 25px; - z-index: 200; + padding-inline: 1.5rem; border-bottom: 1px solid var(--hover-fg); } @@ -550,36 +558,39 @@ html[xmlns] .clearfix { list-style: none; } -/* doc specific */ +/* tables specific */ -.doctable, table { +table { margin: 1em 0; border: 1px solid var(--border); border-collapse: collapse; width: 100%; + @media screen and (max-width:600px) { + font-size: smaller; + } } -.doctable td, .doctable th, table td, table th { +table td, table th { padding: 7px; line-height: 120%; vertical-align: top; border: 1px solid var(--border); } -.doctable tr th, table tr th { +table tr th { background: var(--card-bg); font-size: 110%; } -.doctable td p:first-child { +table td p:first-child { margin-top: 0; } -.doctable td p, li p { +table td p, li p { width: 100% !important; } -.doctable ul { +table ul { margin: 20px 0 } @@ -692,12 +703,15 @@ pre, code { white-space: pre-wrap !important; } +/* footer */ + footer { font-size: 12px; - margin: 60px 5% 30px; display: flex; gap: 24px; flex-direction: column; + padding-block: 2rem; + padding-inline: 3rem; } #footer-content { @@ -722,7 +736,7 @@ footer { max-width: 125px; } -#footer-policy{ +#footer-policy { display: flex; flex-wrap: wrap; column-gap: 20px; @@ -731,15 +745,21 @@ footer { font-size: 15px; } -#footer-links{ +#footer-links { display: flex; gap: 20px; + flex-wrap: wrap; } .footer-social { display: flex; gap: 20px; font-size: 20px; + @media screen and (max-width: 340px) { + display: grid; + grid-template-columns: 1fr 1fr 1fr; + gap: 2.5rem; + } } /* theme and lang btn */ @@ -1139,6 +1159,19 @@ h2 a { } } +/* routing methods columns */ +.methods-columns { + display: flex; + gap: 2rem; + justify-content: space-between; + flex-wrap: wrap; + + @media screen and (max-width: 460px) { + flex-direction: column; + gap: 0.3rem; + } +} + /* responsive */ @media all and (max-width: 1440px) { @@ -1288,18 +1321,28 @@ h2 a { /* TOC responsive */ @media all and (max-width: 800px) { .content { - margin-inline: 0.5rem; - margin-block-start: 100px; flex-direction: column; + padding-inline-start : 0; + margin-block-start: 1rem; + } + + .content main { + padding-inline: 1rem; + width: 100vw; + margin-top: 0; + margin-inline: 0; } #api-doc, #blog-doc, #page-doc { - padding-inline: 1rem; width: 100%; } + #api-doc section { + padding-left: 0; + } + .toc-container { display: flex; flex-direction: column; @@ -1605,11 +1648,6 @@ blockquote { } @media all and (max-width: 1110px) { - header { - column-gap: 12px; - padding-inline: 32px; - } - .desktop-lang-switcher { display: none; }