Skip to content

Commit a1efc64

Browse files
docs: update external docs (#2122)
Co-authored-by: Create or Update Pull Request Action <[email protected]>
1 parent 36b33cf commit a1efc64

File tree

4 files changed

+48
-50
lines changed

4 files changed

+48
-50
lines changed

_data/express.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
current_version: "5.1.0"
1+
current_version: "5.2.1"
22
next_version: "undefined"

_includes/readmes/body-parser.md

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,18 @@ before trusting. For example, `req.body.foo.toString()` may fail in multiple
1717
ways, for example the `foo` property may not be there or may not be a string,
1818
and `toString` may not be a function and instead a string or other user input.
1919

20-
[Learn about the anatomy of an HTTP transaction in Node.js](https://nodejs.org/en/docs/guides/anatomy-of-an-http-transaction/).
20+
[Learn about the anatomy of an HTTP transaction in Node.js](https://nodejs.org/en/learn/http/anatomy-of-an-http-transaction).
2121

2222
_This does not handle multipart bodies_, due to their complex and typically
2323
large nature. For multipart bodies, you may be interested in the following
2424
modules:
2525

26-
* [busboy](https://www.npmjs.org/package/busboy#readme) and
27-
[connect-busboy](https://www.npmjs.org/package/connect-busboy#readme)
28-
* [multiparty](https://www.npmjs.org/package/multiparty#readme) and
29-
[connect-multiparty](https://www.npmjs.org/package/connect-multiparty#readme)
30-
* [formidable](https://www.npmjs.org/package/formidable#readme)
31-
* [multer](https://www.npmjs.org/package/multer#readme)
26+
* [busboy](https://www.npmjs.com/package/busboy#readme) and
27+
[connect-busboy](https://www.npmjs.com/package/connect-busboy#readme)
28+
* [multiparty](https://www.npmjs.com/package/multiparty#readme) and
29+
[connect-multiparty](https://www.npmjs.com/package/connect-multiparty#readme)
30+
* [formidable](https://www.npmjs.com/package/formidable#readme)
31+
* [multer](https://www.npmjs.com/package/multer#readme)
3232

3333
This module provides the following parsers:
3434

@@ -39,8 +39,8 @@ This module provides the following parsers:
3939

4040
Other body parsers you might be interested in:
4141

42-
- [body](https://www.npmjs.org/package/body#readme)
43-
- [co-body](https://www.npmjs.org/package/co-body#readme)
42+
- [body](https://www.npmjs.com/package/body#readme)
43+
- [co-body](https://www.npmjs.com/package/co-body#readme)
4444

4545
## Installation
4646

@@ -109,7 +109,7 @@ accept anything `JSON.parse` accepts. Defaults to `true`.
109109
The `type` option is used to determine what media type the middleware will
110110
parse. This option can be a string, array of strings, or a function. If not a
111111
function, `type` option is passed directly to the
112-
[type-is](https://www.npmjs.org/package/type-is#readme) library and this can
112+
[type-is](https://www.npmjs.com/package/type-is#readme) library and this can
113113
be an extension name (like `json`), a mime type (like `application/json`), or
114114
a mime type with a wildcard (like `*/*` or `*/json`). If a function, the `type`
115115
option is called as `fn(req)` and the request is parsed if it returns a truthy
@@ -154,7 +154,7 @@ to `'100kb'`.
154154
The `type` option is used to determine what media type the middleware will
155155
parse. This option can be a string, array of strings, or a function.
156156
If not a function, `type` option is passed directly to the
157-
[type-is](https://www.npmjs.org/package/type-is#readme) library and this
157+
[type-is](https://www.npmjs.com/package/type-is#readme) library and this
158158
can be an extension name (like `bin`), a mime type (like
159159
`application/octet-stream`), or a mime type with a wildcard (like `*/*` or
160160
`application/*`). If a function, the `type` option is called as `fn(req)`
@@ -205,7 +205,7 @@ to `'100kb'`.
205205
The `type` option is used to determine what media type the middleware will
206206
parse. This option can be a string, array of strings, or a function. If not
207207
a function, `type` option is passed directly to the
208-
[type-is](https://www.npmjs.org/package/type-is#readme) library and this can
208+
[type-is](https://www.npmjs.com/package/type-is#readme) library and this can
209209
be an extension name (like `txt`), a mime type (like `text/plain`), or a mime
210210
type with a wildcard (like `*/*` or `text/*`). If a function, the `type`
211211
option is called as `fn(req)` and the request is parsed if it returns a
@@ -239,7 +239,7 @@ any of the following keys:
239239
The "extended" syntax allows for rich objects and arrays to be encoded into the
240240
URL-encoded format, allowing for a JSON-like experience with URL-encoded. For
241241
more information, please [see the qs
242-
library](https://www.npmjs.org/package/qs#readme).
242+
library](https://www.npmjs.com/package/qs#readme).
243243

244244
Defaults to `false`.
245245

@@ -266,7 +266,7 @@ than this value, a 413 will be returned to the client. Defaults to `1000`.
266266
The `type` option is used to determine what media type the middleware will
267267
parse. This option can be a string, array of strings, or a function. If not
268268
a function, `type` option is passed directly to the
269-
[type-is](https://www.npmjs.org/package/type-is#readme) library and this can
269+
[type-is](https://www.npmjs.com/package/type-is#readme) library and this can
270270
be an extension name (like `urlencoded`), a mime type (like
271271
`application/x-www-form-urlencoded`), or a mime type with a wildcard (like
272272
`*/x-www-form-urlencoded`). If a function, the `type` option is called as
@@ -488,7 +488,7 @@ app.use(bodyParser.text({ type: 'text/html' }))
488488
[coveralls-image]: https://img.shields.io/coverallsCoverage/github/expressjs/body-parser?branch=master
489489
[coveralls-url]: https://coveralls.io/r/expressjs/body-parser?branch=master
490490
[npm-downloads-image]: https://img.shields.io/npm/dm/body-parser
491-
[npm-url]: https://npmjs.org/package/body-parser
491+
[npm-url]: https://npmjs.com/package/body-parser
492492
[npm-version-image]: https://img.shields.io/npm/v/body-parser
493493
[ossf-scorecard-badge]: https://api.scorecard.dev/projects/github.com/expressjs/body-parser/badge
494-
[ossf-scorecard-visualizer]: https://ossf.github.io/scorecard-visualizer/#/projects/github.com/expressjs/body-parser
494+
[ossf-scorecard-visualizer]: https://ossf.github.io/scorecard-visualizer/#/projects/github.com/expressjs/body-parser

_includes/readmes/cors.md

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@
55
[![Build Status][github-actions-ci-image]][github-actions-ci-url]
66
[![Test Coverage][coveralls-image]][coveralls-url]
77

8-
CORS is a node.js package for providing a [Connect](http://www.senchalabs.org/connect/)/[Express](http://expressjs.com/) middleware that can be used to enable [CORS](http://en.wikipedia.org/wiki/Cross-origin_resource_sharing) with various options.
9-
10-
**[Follow me (@troygoode) on Twitter!](https://twitter.com/intent/user?screen_name=troygoode)**
8+
CORS is a [Node.js](https://nodejs.org/en/) package for providing a [Connect](https://github.com/senchalabs/connect)/[Express](https://expressjs.com/) middleware that can be used to enable [CORS](https://developer.mozilla.org/en-US/docs/Web/HTTP/Guides/CORS) with various options.
119

1210
* [Installation](#installation)
1311
* [Usage](#usage)
@@ -19,13 +17,13 @@ CORS is a node.js package for providing a [Connect](http://www.senchalabs.org/co
1917
* [Customizing CORS Settings Dynamically per Request](#customizing-cors-settings-dynamically-per-request)
2018
* [Configuration Options](#configuration-options)
2119
* [License](#license)
22-
* [Author](#author)
20+
* [Original Author](#original-author)
2321

2422
## Installation
2523

2624
This is a [Node.js](https://nodejs.org/en/) module available through the
2725
[npm registry](https://www.npmjs.com/). Installation is done using the
28-
[`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally):
26+
[`npm install` command](https://docs.npmjs.com/downloading-and-installing-packages-locally):
2927

3028
```sh
3129
$ npm install cors
@@ -211,7 +209,7 @@ app.listen(80, function () {
211209
## Configuration Options
212210

213211
* `origin`: Configures the **Access-Control-Allow-Origin** CORS header. Possible values:
214-
- `Boolean` - set `origin` to `true` to reflect the [request origin](http://tools.ietf.org/html/draft-abarth-origin-09), as defined by `req.header('Origin')`, or set it to `false` to disable CORS.
212+
- `Boolean` - set `origin` to `true` to reflect the [request origin](https://datatracker.ietf.org/doc/html/draft-abarth-origin-09), as defined by `req.header('Origin')`, or set it to `false` to disable CORS.
215213
- `String` - set `origin` to a specific origin. For example, if you set it to
216214
- `"http://example.com"` only requests from "http://example.com" will be allowed.
217215
- `"*"` for all domains to be allowed.
@@ -237,21 +235,21 @@ The default configuration is the equivalent of:
237235
}
238236
```
239237

240-
For details on the effect of each CORS header, read [this](https://web.dev/cross-origin-resource-sharing/) article on web.dev.
238+
For details on the effect of each CORS header, read [this](https://web.dev/articles/cross-origin-resource-sharing) article.
241239

242240
## License
243241

244242
[MIT License](http://www.opensource.org/licenses/mit-license.php)
245243

246-
## Author
244+
## Original Author
247245

248246
[Troy Goode](https://github.com/TroyGoode) ([[email protected]](mailto:[email protected]))
249247

250248
[coveralls-image]: https://img.shields.io/coveralls/expressjs/cors/master.svg
251249
[coveralls-url]: https://coveralls.io/r/expressjs/cors?branch=master
252250
[downloads-image]: https://img.shields.io/npm/dm/cors.svg
253-
[downloads-url]: https://npmjs.org/package/cors
251+
[downloads-url]: https://npmjs.com/package/cors
254252
[github-actions-ci-image]: https://img.shields.io/github/actions/workflow/status/expressjs/cors/ci.yml?branch=master&label=ci
255253
[github-actions-ci-url]: https://github.com/expressjs/cors?query=workflow%3Aci
256254
[npm-image]: https://img.shields.io/npm/v/cors.svg
257-
[npm-url]: https://npmjs.org/package/cors
255+
[npm-url]: https://npmjs.com/package/cors

_includes/readmes/serve-static.md

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ $ npm install serve-static
1818
## API
1919

2020
```js
21-
var serveStatic = require('serve-static')
21+
const serveStatic = require('serve-static')
2222
```
2323

2424
### serveStatic(root, options)
@@ -132,15 +132,15 @@ the arguments are:
132132
### Serve files with vanilla node.js http server
133133

134134
```js
135-
var finalhandler = require('finalhandler')
136-
var http = require('http')
137-
var serveStatic = require('serve-static')
135+
const finalhandler = require('finalhandler')
136+
const http = require('http')
137+
const serveStatic = require('serve-static')
138138

139139
// Serve up public/ftp folder
140-
var serve = serveStatic('public/ftp', { index: ['index.html', 'index.htm'] })
140+
const serve = serveStatic('public/ftp', { index: ['index.html', 'index.htm'] })
141141

142142
// Create server
143-
var server = http.createServer(function onRequest (req, res) {
143+
const server = http.createServer((req, res) => {
144144
serve(req, res, finalhandler(req, res))
145145
})
146146

@@ -151,13 +151,13 @@ server.listen(3000)
151151
### Serve all files as downloads
152152

153153
```js
154-
var contentDisposition = require('content-disposition')
155-
var finalhandler = require('finalhandler')
156-
var http = require('http')
157-
var serveStatic = require('serve-static')
154+
const contentDisposition = require('content-disposition')
155+
const finalhandler = require('finalhandler')
156+
const http = require('http')
157+
const serveStatic = require('serve-static')
158158

159159
// Serve up public/ftp folder
160-
var serve = serveStatic('public/ftp', {
160+
const serve = serveStatic('public/ftp', {
161161
index: false,
162162
setHeaders: setHeaders
163163
})
@@ -168,7 +168,7 @@ function setHeaders (res, path) {
168168
}
169169

170170
// Create server
171-
var server = http.createServer(function onRequest (req, res) {
171+
const server = http.createServer((req, res) => {
172172
serve(req, res, finalhandler(req, res))
173173
})
174174

@@ -183,10 +183,10 @@ server.listen(3000)
183183
This is a simple example of using Express.
184184

185185
```js
186-
var express = require('express')
187-
var serveStatic = require('serve-static')
186+
const express = require('express')
187+
const serveStatic = require('serve-static')
188188

189-
var app = express()
189+
const app = express()
190190

191191
app.use(serveStatic('public/ftp', { index: ['default.html', 'default.htm'] }))
192192
app.listen(3000)
@@ -199,11 +199,11 @@ Files are searched for in `public-optimized/` first, then `public/` second
199199
as a fallback.
200200

201201
```js
202-
var express = require('express')
203-
var path = require('path')
204-
var serveStatic = require('serve-static')
202+
const express = require('express')
203+
const path = require('path')
204+
const serveStatic = require('serve-static')
205205

206-
var app = express()
206+
const app = express()
207207

208208
app.use(serveStatic(path.join(__dirname, 'public-optimized')))
209209
app.use(serveStatic(path.join(__dirname, 'public')))
@@ -217,11 +217,11 @@ file. In this example, HTML files are not cached, while everything else
217217
is for 1 day.
218218

219219
```js
220-
var express = require('express')
221-
var path = require('path')
222-
var serveStatic = require('serve-static')
220+
const express = require('express')
221+
const path = require('path')
222+
const serveStatic = require('serve-static')
223223

224-
var app = express()
224+
const app = express()
225225

226226
app.use(serveStatic(path.join(__dirname, 'public'), {
227227
maxAge: '1d',

0 commit comments

Comments
 (0)