app.post('/register', express.BodyParser(), function (req, res){
var newu = new UserModel({});
newu.user = req.body.nuser;
newu.pass = req.body.npass;
newu.mail = req.body.nmail;
var pathu = __dirname + '/users/' + req.body.nuser;
newu.save(function (err, newu){
req.session.user = new.user;
if(err) throw err;
fs.mkdir(pathu, function (err){
if (err) throw err;
});
});
res.redirect('/home);
});
总是在执行 fs.mkdir 时,我会丢失所有当前的 Express 会话,有没有办法执行 fs.mkdir 并保留所有 Express 会话?