我用Express尝试写个小网站,但是每到要获取post数据的时候,就一直卡着.get请求时正常的,求指导怎么回事.
router.post('/text',function(req,res){
var postData = "";
var pathname = url.parse(req.url).pathname;
console.log("Request for " + pathname + " received.");
req.setEncoding("utf8");
req.addListener("data", function(postDataChunk) {
postData += postDataChunk;
console.log("Received POST data chunk '"+
postDataChunk + "'.");
});
req.addListener("end",function(){
console.log("OK");
});
});
当进入data方法的时候就不会继续了,代码应该没错吧,求指导.