This package has been deprecated

Author message:

Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

body-parser-multidict

1.1.3 • Public • Published

body-parser-multidict

Build Status

Fork of body-parser with Werkzeug's MultiDict support for urlencoded forms

We built querystring-multidict for consistent typing when reading query strings (e.g. .get() always returns a single string value whereas querystring/qs can return an array/object depending on user input). Additionally, we added .fetch() to make throwing form validation errors easier.

Getting Started

This module can be installed via: npm install body-parser-multidict

Its usage is the same as body-parser:

// Load in our dependencies
var express = require('express');
var bodyParserMultiDict = require('body-parser-multidict');
 
// Create a new app using our urlencoded parser
var app = express();
app.use(bodyParser.urlencoded());
 
// Handle requests
app.use(function (req, res) {
  // Example request: `POST foo=bar&foo=baz`
  // First received value under key
  req.body.get('foo'); // 'bar'
  // Array of values received under key
  req.body.getArray('foo');// ['bar', 'baz']
});

Documentation

Documentation is the same as body-parser except req.body is a MultiDict. See querystring-multidict for MultiDict documentation:

https://github.com/twolfson/querystring-multidict/tree/1.1.0#multidict

License

MIT

Readme

Keywords

none

Package Sidebar

Install

npm i body-parser-multidict

Weekly Downloads

1

Version

1.1.3

License

MIT

Unpacked Size

23.6 kB

Total Files

10

Last publish

Collaborators

  • twolfson