1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
| const qs=require('querystring') const bodyParser=(req,res,next)=>{ let str="" req.on('data',(chunk)=>{ str+=chunk }) req.on('end',()=>{ const body=qs.parse(str) req.body=body next() }) } module.exports=bodyParser
|