"name": "body-parser", "version": "1.13.3",
我的json请求正文是{user:'guow'}
,但是表达request.body是{ '{user:\'guow\'}': '' }
这是我的快递应用程序的配置
var bodyParser = require('body-parser'); //
var multer = require('multer');
app.use(bodyParser.json()); // for parsing application/json
app.use(bodyParser.urlencoded({ extended: false })); // for parsing application/x-www-form-urlencoded //
app.use(multer());
我用jquery发送请求,我的代码是
$.ajax({ type: “POST”, url: “/login”, cache: false, dataType: 'json', data:“{user:'guow'}"});
有人会遇到这样的问题吗?
答案 0 :(得分:-1)
$.ajax({ type: "POST",
url: "/login",
cache: false,
dataType: 'json',
data:{"user":"guow"}
});