#body-parser
node.js body parsing 中间件
安装
1 | $ npm install body-parser |
API
1 | var bodyPaeser =require('body-parser') |
#body-parser
1 | $ npm install body-parser |
1 | var bodyPaeser =require('body-parser') |
body-parser 对象创建中间件,当接收到客户端请求时所有的中间件都会给req.body 添加属性,请求体为空,则解析为空{} (或者出现错误)。json ,允许请求提任意Unicode编码支持 gzip 和 deflate 编码。bytes库 转换为字节大小。JSON.parse 能接受的。type 选项用来决定中间件要解析媒体类型。选项可以是一个函数或者是字符串。当为字符串时,可以直接通过type-is 库直接传递给选项,字符串也可以为一个扩展名(例如json)、mime 类型(application/json、/ 、*/json)。当为函数时:默认为application/json。gzip deflate 压缩。gzip deflate 压缩。urlencoded 请求体,并返回,只支持UTF-8编号文本,支持gzip deflate 压缩。Update your browser to view this website correctly. Update my browser now