我正在运行express-stormpath auth的快速服务器并存储有关用户的相同自定义数据。Stormpath Express:保存自定义数据
如何发布数据到服务器并将它们保存为stormpath? 目前我的帖子是这样的:
app.post('/post', stormpath.loginRequired, function(req, res) {
var stundenplan_data = req.body;
console.log(stundenplan_data);
req.user.customData.stundenplan = stundenplan_data;
req.user.customData.save();
});
我得到我想要的的console.log后,但如果我叫在另一个get请求的数据自定义数据是空的正确的数据。
你可以传递一个回调来保存()函数,看它是否返回任何错误? – robertjd 2014-11-14 22:21:46
没有IAM没有得到unsing当任何错误:res.locals.user.save(函数(ERR,updatedUser){ \t \t如果(ERR){ \t \t updatedUser.customData.anotherfield; \t \t的console.log(! “error”); // undefined \t \t} \t}); – brighthero 2014-11-15 10:18:33