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

Function createServer

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

Source from the content-addressed store, hash-verified

543})
544
545function createServer (opts) {
546 var _bodyParser = typeof opts !== 'function'
547 ? bodyParser.text(opts)
548 : opts
549
550 return http.createServer(function (req, res) {
551 _bodyParser(req, res, function (err) {
552 res.statusCode = err ? (err.status || 500) : 200
553 res.end(err ? ('[' + err.type + '] ' + err.message) : JSON.stringify(req.body))
554 })
555 })
556}
557
558function tryRequire (name) {
559 try {

Callers 1

text.jsFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected