MCPcopy
hub / github.com/expressjs/body-parser / createServer

Function createServer

test/urlencoded.js:948–964  ·  view source on GitHub ↗
(opts)

Source from the content-addressed store, hash-verified

946}
947
948function createServer (opts) {
949 const _bodyParser = typeof opts !== 'function'
950 ? bodyParser.urlencoded(opts)
951 : opts
952
953 return http.createServer(function (req, res) {
954 _bodyParser(req, res, function (err) {
955 if (err) {
956 res.statusCode = err.status || 500
957 res.end('[' + err.type + '] ' + err.message)
958 } else {
959 res.statusCode = 200
960 res.end(JSON.stringify(req.body) || typeof req.body)
961 }
962 })
963 })
964}
965
966function expectKeyCount (count) {
967 return function (res) {

Callers 1

urlencoded.jsFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…