From 1333bd810521e8aada6ad375ec55f5675b7048ea Mon Sep 17 00:00:00 2001 From: Douglas Christopher Wilson Date: Fri, 24 Nov 2023 10:37:09 -0500 Subject: [PATCH] Update middleware readmes --- _includes/readmes/body-parser.md | 23 ++++++++++++----------- _includes/readmes/compression.md | 8 +++----- _includes/readmes/cookie-session.md | 12 +++++++++++- _includes/readmes/multer.md | 15 +++++++++------ _includes/readmes/vhost.md | 8 +++----- 5 files changed, 38 insertions(+), 28 deletions(-) diff --git a/_includes/readmes/body-parser.md b/_includes/readmes/body-parser.md index 1149aff57e..38553bf798 100644 --- a/_includes/readmes/body-parser.md +++ b/_includes/readmes/body-parser.md @@ -1,8 +1,8 @@ # body-parser -[![NPM Version][npm-image]][npm-url] -[![NPM Downloads][downloads-image]][downloads-url] -[![Build Status][github-actions-ci-image]][github-actions-ci-url] +[![NPM Version][npm-version-image]][npm-url] +[![NPM Downloads][npm-downloads-image]][npm-url] +[![Build Status][ci-image]][ci-url] [![Test Coverage][coveralls-image]][coveralls-url] Node.js body parsing middleware. @@ -346,7 +346,7 @@ call `req.setEncoding` when using this module. The `status` property is set to This error will occur when the request is no longer readable when this middleware attempts to read it. This typically means something other than a middleware from -this module read the reqest body already and the middleware was also configured to +this module read the request body already and the middleware was also configured to read the same request. The `status` property is set to `500` and the `type` property is set to `'stream.not.readable'`. @@ -454,11 +454,12 @@ app.use(bodyParser.text({ type: 'text/html' })) [MIT](LICENSE) -[npm-image]: https://img.shields.io/npm/v/body-parser.svg -[npm-url]: https://npmjs.org/package/body-parser -[coveralls-image]: https://img.shields.io/coveralls/expressjs/body-parser/master.svg +[ci-image]: https://badgen.net/github/checks/expressjs/body-parser/master?label=ci +[ci-url]: https://github.com/expressjs/body-parser/actions/workflows/ci.yml +[coveralls-image]: https://badgen.net/coveralls/c/github/expressjs/body-parser/master [coveralls-url]: https://coveralls.io/r/expressjs/body-parser?branch=master -[downloads-image]: https://img.shields.io/npm/dm/body-parser.svg -[downloads-url]: https://npmjs.org/package/body-parser -[github-actions-ci-image]: https://img.shields.io/github/workflow/status/expressjs/body-parser/ci/master?label=ci -[github-actions-ci-url]: https://github.com/expressjs/body-parser/actions/workflows/ci.yml +[node-version-image]: https://badgen.net/npm/node/body-parser +[node-version-url]: https://nodejs.org/en/download +[npm-downloads-image]: https://badgen.net/npm/dm/body-parser +[npm-url]: https://npmjs.org/package/body-parser +[npm-version-image]: https://badgen.net/npm/v/body-parser diff --git a/_includes/readmes/compression.md b/_includes/readmes/compression.md index 680ece8776..eb4d88784b 100644 --- a/_includes/readmes/compression.md +++ b/_includes/readmes/compression.md @@ -2,7 +2,7 @@ [![NPM Version][npm-image]][npm-url] [![NPM Downloads][downloads-image]][downloads-url] -[![Build Status][travis-image]][travis-url] +[![Build Status][github-actions-ci-image]][github-actions-ci-url] [![Test Coverage][coveralls-image]][coveralls-url] Node.js compression middleware. @@ -24,8 +24,6 @@ $ npm install compression ## API - - ```js var compression = require('compression') ``` @@ -232,9 +230,9 @@ app.get('/events', function (req, res) { [npm-image]: https://img.shields.io/npm/v/compression.svg [npm-url]: https://npmjs.org/package/compression -[travis-image]: https://img.shields.io/travis/expressjs/compression/master.svg -[travis-url]: https://travis-ci.org/expressjs/compression [coveralls-image]: https://img.shields.io/coveralls/expressjs/compression/master.svg [coveralls-url]: https://coveralls.io/r/expressjs/compression?branch=master [downloads-image]: https://img.shields.io/npm/dm/compression.svg [downloads-url]: https://npmjs.org/package/compression +[github-actions-ci-image]: https://badgen.net/github/checks/expressjs/compression/master?label=ci +[github-actions-ci-url]: https://github.com/expressjs/compression/actions?query=workflow%3Aci diff --git a/_includes/readmes/cookie-session.md b/_includes/readmes/cookie-session.md index 3126decd36..70c5c03afe 100644 --- a/_includes/readmes/cookie-session.md +++ b/_includes/readmes/cookie-session.md @@ -21,6 +21,16 @@ The following points can help you choose which to use: * `cookie-session` can be used to store a "light" session and include an identifier to look up a database-backed secondary store to reduce database lookups. +**NOTE** This module does not encrypt the session contents in the cookie, only provides +signing to prevent tampering. The client will be able to read the session data by +examining the cookie's value. Secret data should not be set in `req.session` without +encrypting it, or use a server-side session instead. + +**NOTE** This module does not prevent session replay, as the expiration set is that +of the cookie only; if that is a concern of your application, you can store an expiration +date in `req.session` object and validate it on the sever, and implement any other logic +to extend the session as your application needs. + ## Install This is a [Node.js](https://nodejs.org/en/) module available through the @@ -125,7 +135,7 @@ altered to change cookie setting behavior on a per-request basis. To destroy a session simply set it to `null`: -``` +```js req.session = null ``` diff --git a/_includes/readmes/multer.md b/_includes/readmes/multer.md index 7f5d08071c..fc5702a3be 100644 --- a/_includes/readmes/multer.md +++ b/_includes/readmes/multer.md @@ -5,16 +5,19 @@ on top of [busboy](https://github.com/mscdex/busboy) for maximum efficiency. **NOTE**: Multer will not process any form which is not multipart (`multipart/form-data`). -## Translations +## Translations This README is also available in other languages: +- [العربية](https://github.com/expressjs/multer/blob/master/doc/README-ar.md) (Arabic) - [Español](https://github.com/expressjs/multer/blob/master/doc/README-es.md) (Spanish) - [简体中文](https://github.com/expressjs/multer/blob/master/doc/README-zh-cn.md) (Chinese) - [한국어](https://github.com/expressjs/multer/blob/master/doc/README-ko.md) (Korean) - [Русский язык](https://github.com/expressjs/multer/blob/master/doc/README-ru.md) (Russian) - [Việt Nam](https://github.com/expressjs/multer/blob/master/doc/README-vi.md) (Vietnam) - [Português](https://github.com/expressjs/multer/blob/master/doc/README-pt-br.md) (Portuguese Brazil) +- [Français](https://github.com/expressjs/multer/blob/master/doc/README-fr.md) (French) +- [O'zbek tili](https://github.com/expressjs/multer/blob/master/doc/README-uz.md) (Uzbek) ## Installation @@ -85,7 +88,7 @@ Here's an example on how multer is used an HTML form. Take special note of the `
- +
``` @@ -96,9 +99,9 @@ Then in your javascript file you would add these lines to access both the file a const multer = require('multer') const upload = multer({ dest: './public/data/uploads/' }) app.post('/stats', upload.single('uploaded_file'), function (req, res) { - // req.file is the name of your file in the form above, here 'uploaded_file' - // req.body will hold the text fields, if there were any - console.log(req.file, req.body) + // req.file is the name of your file in the form above, here 'uploaded_file' + // req.body will hold the text fields, if there were any + console.log(req.file, req.body) }); ``` @@ -239,7 +242,7 @@ order that the client transmits fields and files to the server. For understanding the calling convention used in the callback (needing to pass null as the first param), refer to -[Node.js error handling](https://www.joyent.com/node-js/production/design/errors) +[Node.js error handling](https://web.archive.org/web/20220417042018/https://www.joyent.com/node-js/production/design/errors) #### `MemoryStorage` diff --git a/_includes/readmes/vhost.md b/_includes/readmes/vhost.md index f6289dc9c4..422e67f476 100644 --- a/_includes/readmes/vhost.md +++ b/_includes/readmes/vhost.md @@ -2,7 +2,7 @@ [![NPM Version][npm-image]][npm-url] [![NPM Downloads][downloads-image]][downloads-url] -[![Build Status][travis-image]][travis-url] +[![Build Status][github-actions-ci-image]][github-actions-ci-url] [![Test Coverage][coveralls-image]][coveralls-url] ## Install @@ -13,8 +13,6 @@ $ npm install vhost ## API - - ```js var vhost = require('vhost') ``` @@ -157,9 +155,9 @@ app.listen(3000) [npm-image]: https://img.shields.io/npm/v/vhost.svg [npm-url]: https://npmjs.org/package/vhost -[travis-image]: https://img.shields.io/travis/expressjs/vhost/master.svg -[travis-url]: https://travis-ci.org/expressjs/vhost [coveralls-image]: https://img.shields.io/coveralls/expressjs/vhost/master.svg [coveralls-url]: https://coveralls.io/r/expressjs/vhost [downloads-image]: https://img.shields.io/npm/dm/vhost.svg [downloads-url]: https://npmjs.org/package/vhost +[github-actions-ci-image]: https://img.shields.io/github/actions/workflow/status/expressjs/vhost/ci.yml?branch=master&label=ci +[github-actions-ci-url]: https://github.com/expressjs/vhost/actions/workflows/ci.yml