Skip to content

Commit

Permalink
Update middleware readmes
Browse files Browse the repository at this point in the history
  • Loading branch information
dougwilson committed Nov 24, 2023
1 parent fcaca7f commit 1333bd8
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 28 deletions.
23 changes: 12 additions & 11 deletions _includes/readmes/body-parser.md
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -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'`.

Expand Down Expand Up @@ -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
8 changes: 3 additions & 5 deletions _includes/readmes/compression.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -24,8 +24,6 @@ $ npm install compression

## API

<!-- eslint-disable no-unused-vars -->

```js
var compression = require('compression')
```
Expand Down Expand Up @@ -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
12 changes: 11 additions & 1 deletion _includes/readmes/cookie-session.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
```

Expand Down
15 changes: 9 additions & 6 deletions _includes/readmes/multer.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -85,7 +88,7 @@ Here's an example on how multer is used an HTML form. Take special note of the `
<div class="form-group">
<input type="file" class="form-control-file" name="uploaded_file">
<input type="text" class="form-control" placeholder="Number of speakers" name="nspeakers">
<input type="submit" value="Get me the stats!" class="btn btn-default">
<input type="submit" value="Get me the stats!" class="btn btn-default">
</div>
</form>
```
Expand All @@ -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)
});
```

Expand Down Expand Up @@ -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`

Expand Down
8 changes: 3 additions & 5 deletions _includes/readmes/vhost.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -13,8 +13,6 @@ $ npm install vhost

## API

<!-- eslint-disable no-unused-vars -->

```js
var vhost = require('vhost')
```
Expand Down Expand Up @@ -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

0 comments on commit 1333bd8

Please sign in to comment.