MCPcopy Create free account
hub / github.com/expressjs/body-parser / bodyParser

Function bodyParser

index.js:93–113  ·  view source on GitHub ↗

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

(options)

Source from the content-addressed store, hash-verified

91 */
92
93function bodyParser (options) {
94 // use default type for parsers
95 var opts = Object.create(options || null, {
96 type: {
97 configurable: true,
98 enumerable: true,
99 value: undefined,
100 writable: true
101 }
102 })
103
104 var _urlencoded = exports.urlencoded(opts)
105 var _json = exports.json(opts)
106
107 return function bodyParser (req, res, next) {
108 _json(req, res, function (err) {
109 if (err) return next(err)
110 _urlencoded(req, res, next)
111 })
112 }
113}
114
115/**
116 * Create a getter for loading a parser.

Callers 2

body-parser.jsFile · 0.85
createServerFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected