为什么 nodejs没有内置像PHP的$POST或$GET


如果没有使用express(body-parser),怎么优雅地解析post数据?

node.js php

Asasaki 9 years, 6 months ago

你可以使用Node的一些HTTP模块,类似这个一样: 链接描述

野生D淚老湿 answered 9 years, 6 months ago

nodejs更接近底层,所合http模块没有提供更高成的封装只是在listener里传入request,response参数供处理,
express也是加入了中间件(body-parser)进行解析,当然如果有必要是可以自己实现中间层的


 function(req,res){
    yourselfConnect(req,res);
}

末叶蓓蓓 answered 9 years, 6 months ago

Your Answer