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

Function createServer

test/text.js:573–587  ·  view source on GitHub ↗
(opts)

Source from the content-addressed store, hash-verified

571})
572
573function createServer (opts) {
574 const _bodyParser = typeof opts !== 'function'
575 ? bodyParser.text(opts)
576 : opts
577
578 return http.createServer(function (req, res) {
579 _bodyParser(req, res, function (err) {
580 res.statusCode = err ? (err.status || 500) : 200
581 res.end(err
582 ? ('[' + err.type + '] ' + err.message)
583 : (JSON.stringify(req.body) || typeof req.body)
584 )
585 })
586 })
587}

Callers 1

text.jsFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected