兵团
流式 HTTP 请求正文解析器
npm install corps
用法
var body = require ( 'corps' ) ;
http . createServer ( function ( req , res ) {
body . auto ( req ) . map ( function ( data ) {
res . end ( data . greeting + "world" ) ;
} ) ;
} ) . listen ( 3000 ) ;
$ curl -X POST -D ' {"greeting": "salutations"} ' -H ' Content-type: application/json ' localhost:8000
salutations world
$ curl -X POST -D ' greeting=wh
评论0
最新资源