(opts)
| 543 | }) |
| 544 | |
| 545 | function 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 | |
| 558 | function tryRequire (name) { |
| 559 | try { |