2
在节点express中,当我尝试从表单中访问post值时,它显示request body undefined error。 这里是我的代码,request body undefined in node express
http.createServer(function(req, res) {
var hostname = req.headers.host.split(":")[0];
var pathname = url.parse(req.url).pathname;
if (pathname==="/login" && req.method ==="POST") {
console.log("request Header==>" + req.body.username);
}).listen(9000, function() {
console.log('http://localhost:9000');
});
请任何一个可以帮助我找到原因请求主体显示不确定的。
我们使用相同的中间件,但服务器是http代理 – jicks