demo/body-parser/index.js
function bodyParser (options) {
  var opts = {}

  // exclude type option
  if (options) {
    for (var prop in options) {
      if (prop !== 'type') {
        opts[prop] = options[prop]
      }
    }
  }

  var _urlencoded = exports.urlencoded(opts)
  var _json = exports.json(opts)

  return function bodyParser (req, res, next) {
    _json(req, res, function (err) {
      if (err) return next(err)
      _urlencoded(req, res, next)
    })
  }
}
function bodyParser (options) {
  var opts = {}

  // exclude type option
  if (options) {
    for (var prop in options) {
      if (prop !== 'type') {
        opts[prop] = options[prop]
      }
    }
  }

  var _urlencoded = exports.urlencoded(opts)
  var _json = exports.json(opts)

  return function bodyParser (req, res, next) {
    _json(req, res, function (err) {
      if (err) return next(err)
      _urlencoded(req, res, next)
    })
  }
}
function bodyParser ( options ) { var opts = { } // exclude type option if ( options ) { for ( var prop in options ) { if ( prop !== 'type' ) { opts [ prop ] = options [ prop ] } } } var _urlencoded = exports . urlencoded ( opts ) var _json = exports . json ( opts ) return function bodyParser ( req , res , next ) { _json ( req , res , function ( err ) { if ( err ) return next ( err ) _urlencoded ( req , res , next ) } ) } }
Create a middleware to parse json and urlencoded bodies.

@param {object} [options]
@return {function}
@deprecated
@public
Create a middleware to parse json and urlencoded bodies .