var session = require('express-session');
var MongoStore = require('connect-mongo')(session);
app.use(session({
secret: 'foo',
store: new MongoStore(options)
}));
var MongoStore = require('connect-mongo')(session);
app.use(session({
secret: 'foo',
store: new MongoStore(options)
}));
2015-05-26
修改了电影的分类之后首页展示的和分类列表就不对了,因为保存movie的时候没有把movie保存到category的movies数组里
2015-05-22
与其判断一个个的错误情况,不如判断条件是否达到要求而执行即可:
exports.adminRequired = function(req, res, next){
var user = req.session.user;
if(10 <= user.role){
next();
}else{
return adminError(res, '管理员权限不足', '/admin/user/list');
}
};
exports.adminRequired = function(req, res, next){
var user = req.session.user;
if(10 <= user.role){
next();
}else{
return adminError(res, '管理员权限不足', '/admin/user/list');
}
};
2015-05-22
cookieParser以及session已经从express中分离出来了,需要以module的形式安装和导入。具体参照https://github.com/senchalabs/connect#middleware
2015-05-04