+
@@ -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 |
-
+
\ 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`
- |
-
-
+
+
+ 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").