diff --git a/src/config/menu/api.ts b/src/config/menu/api.ts index 1afb9a6652..c72e50fd1e 100644 --- a/src/config/menu/api.ts +++ b/src/config/menu/api.ts @@ -116,9 +116,15 @@ export const apiMenu: Menu = { label: 'app.get(path)', omitFrom: ['3x'], }, + { + href: '/api/application#applisten', + label: 'app.listen()', + omitFrom: ['4x', '5x'], + }, { href: '/api/application#applistenport-host-backlog-callback', label: 'app.listen()', + omitFrom: ['3x'], }, { href: '/api/application#appmethodpath-callback--callback-', @@ -148,7 +154,16 @@ export const apiMenu: Menu = { omitFrom: ['3x'], }, { href: '/api/application#appsetname-value', label: 'app.set()' }, - { href: '/api/application#appusepath-callback--callback', label: 'app.use()' }, + { + href: '/api/application#appusepath-function', + label: 'app.use()', + omitFrom: ['4x', '5x'], + }, + { + href: '/api/application#appusepath-callback--callback', + label: 'app.use()', + omitFrom: ['3x'], + }, { href: '/api/application#appverbpath-callback-callback', label: 'app.VERB()', @@ -292,17 +307,17 @@ export const apiMenu: Menu = { label: 'req.acceptsLanguages()', omitFrom: ['3x'], }, - { href: '/api/request#reqgetfield', label: 'req.get()', omitFrom: ['3x'] }, + { href: '/api/request#reqgetfield', label: 'req.get()' }, + { href: '/api/request#reqistype', label: 'req.is()' }, { - href: '/api/request#reqheaderfield', - label: 'req.header()', + href: '/api/request#reqparamname', + label: 'req.param()', omitFrom: ['4x', '5x'], }, - { href: '/api/request#reqistype', label: 'req.is()' }, { - href: '/api/request#reqparamname', + href: '/api/request#reqparamname--defaultvalue', label: 'req.param()', - omitFrom: ['5x'], + omitFrom: ['3x', '5x'], }, { href: '/api/request#reqrangesize-options', @@ -361,9 +376,15 @@ export const apiMenu: Menu = { { href: '/api/response#resattachmentfilename', label: 'res.attachment()' }, { href: '/api/response#resclearcookiename--options', label: 'res.clearCookie()' }, { href: '/api/response#rescookiename-value--options', label: 'res.cookie()' }, + { + href: '/api/response#resdownloadpath-filename-fn', + label: 'res.download()', + omitFrom: ['4x', '5x'], + }, { href: '/api/response#resdownloadpath--filename--options--fn', label: 'res.download()', + omitFrom: ['3x'], }, { href: '/api/response#resenddata-encoding-callback', @@ -372,13 +393,28 @@ export const apiMenu: Menu = { }, { href: `/api/response#resformatobject`, label: 'res.format()' }, { href: '/api/response#resgetfield', label: 'res.get()' }, - { href: `/api/response#resjsonbody`, label: 'res.json()' }, - { href: '/api/response#resjsonpbody', label: 'res.jsonp()' }, + { + href: `/api/response#resjsonstatusbody-body`, + label: 'res.json()', + omitFrom: ['4x', '5x'], + }, + { href: `/api/response#resjsonbody`, label: 'res.json()', omitFrom: ['3x'] }, + { + href: '/api/response#resjsonpstatusbody-body', + label: 'res.jsonp()', + omitFrom: ['4x', '5x'], + }, + { href: '/api/response#resjsonpbody', label: 'res.jsonp()', omitFrom: ['3x'] }, { href: '/api/response#reslinkslinks', label: 'res.links()' }, { href: '/api/response#reslocationpath', label: 'res.location()' }, { href: '/api/response#resredirectstatus-path', label: 'res.redirect()' }, { href: `/api/response#resrenderview--locals--callback`, label: 'res.render()' }, - { href: `/api/response#ressendbody`, label: 'res.send()' }, + { + href: `/api/response#ressendbodystatus-body`, + label: 'res.send()', + omitFrom: ['4x', '5x'], + }, + { href: `/api/response#ressendbody`, label: 'res.send()', omitFrom: ['3x'] }, { href: '/api/response#ressendfilepath-options-fn', label: 'res.sendfile()', diff --git a/src/content/api/3x/api/application/index.mdx b/src/content/api/3x/api/application/index.mdx index 0f7e469613..e3282322e2 100644 --- a/src/content/api/3x/api/application/index.mdx +++ b/src/content/api/3x/api/application/index.mdx @@ -488,7 +488,7 @@ app.post('/forum/:fid/thread/:tid', middleware, function () { }); ``` -### app.all(path, [callback...], callback) +### app.all(path, callback [, callback ...]) This method functions just like the `app.VERB()` methods, however it matches all HTTP verbs. @@ -521,7 +521,7 @@ the example is much like before, however only restricting paths prefixed with app.all('/api/*', requireAuthentication); ``` -### app.render(view, [options], callback) +### app.render(view, [locals], callback) Render a `view` with a callback responding with the rendered string. This is the app-level variant of `res.render()`, diff --git a/src/content/api/3x/api/response/index.mdx b/src/content/api/3x/api/response/index.mdx index f488de7412..9baf5ab055 100644 --- a/src/content/api/3x/api/response/index.mdx +++ b/src/content/api/3x/api/response/index.mdx @@ -62,7 +62,7 @@ res.attachment('path/to/logo.png'); // Content-Type: image/png ``` -### res.clearCookie(name, [options]) +### res.clearCookie(name [, options]) Clear cookie `name`. The `path` option defaults to "/". @@ -71,7 +71,7 @@ res.cookie('name', 'tobi', { path: '/admin' }); res.clearCookie('name', { path: '/admin' }); ``` -### res.cookie(name, value, [options]) +### res.cookie(name, value [, options]) Set cookie `name` to `value`, which may be a string or object converted to JSON. The `path` option defaults to "/". @@ -264,7 +264,7 @@ Link: rel="next", rel="last" ``` -### res.location() +### res.location(path) Set the location header. @@ -276,7 +276,7 @@ res.location('../login'); res.location('back'); ``` -You can use the same kind of `urls` as in `res.redirect()`. +You can use the same kind of `path` as in `res.redirect()`. For example, if your application is mounted at `/blog`, the following would set the `location` header to @@ -286,10 +286,11 @@ the following would set the `location` header to res.location('admin'); ``` -### res.redirect([status], url) +### res.redirect([status,] path) -Redirect to the given `url` with optional `status` code -defaulting to 302 "Found". +Redirects to the URL derived from the specified `path`, with specified `status`, a positive integer +that corresponds to an [HTTP status code](https://www.rfc-editor.org/rfc/rfc9110#name-status-codes). +If not specified, `status` defaults to "302 "Found". ```js res.redirect('/foo/bar'); @@ -338,7 +339,7 @@ the Referer (or Referrer), defaulting to `/` when missing. res.redirect('back'); ``` -### res.render(view, [locals], callback) +### res.render(view [, locals] [, callback]) Render a `view` with a callback responding with the rendered string. When an error occurs `next(err)` @@ -440,7 +441,7 @@ app.get('/user/:uid/photos/:file', function (req, res) { }); ``` -### res.set(field, [value]) +### res.set(field [, value]) Set header `field` to `value`, or pass an object to set multiple fields at once. diff --git a/src/content/api/4x/api/response/index.mdx b/src/content/api/4x/api/response/index.mdx index fa9559dab4..b0e11a207b 100644 --- a/src/content/api/4x/api/response/index.mdx +++ b/src/content/api/4x/api/response/index.mdx @@ -472,7 +472,7 @@ or the referring URL, and the URL specified in the `Location` header; and redire ### res.redirect([status,] path) Redirects to the URL derived from the specified `path`, with specified `status`, a positive integer -that corresponds to an [HTTP status code](https://www.rfc-editor.org/rfc/rfc9110#name-status-codes) . +that corresponds to an [HTTP status code](https://www.rfc-editor.org/rfc/rfc9110#name-status-codes). If not specified, `status` defaults to "302 "Found". ```js