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

Function createServer

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

Source from the content-addressed store, hash-verified

798}
799
800function createServer (opts) {
801 var _bodyParser = typeof opts !== 'function'
802 ? bodyParser.urlencoded(opts)
803 : opts
804
805 return http.createServer(function (req, res) {
806 _bodyParser(req, res, function (err) {
807 if (err) {
808 res.statusCode = err.status || 500
809 res.end('[' + err.type + '] ' + err.message)
810 } else {
811 res.statusCode = 200
812 res.end(JSON.stringify(req.body))
813 }
814 })
815 })
816}
817
818function expectKeyCount (count) {
819 return function (res) {

Callers 1

urlencoded.jsFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected