你在app.js中判断了如果req.session.user不为空就把user放在locals中, 应该把这个if条件去掉。这样当session中的user为空的时候, locals中的值也就随之变成空。
2015-07-18
NPM 包说明里面不建议使用这个作为Midware , 因为有tempFile ,而且不会自动清理
connect middleware for multiparty.
This middleware will create temp files on your server and never clean them up. Thus you should not add this middleware to all routes; only to the ones in which you want to accept uploads.
connect middleware for multiparty.
This middleware will create temp files on your server and never clean them up. Thus you should not add this middleware to all routes; only to the ones in which you want to accept uploads.
2015-07-18
老师老师!!
app.use(bodyParser.urlencoded({ extended: false }));
app.use(bodyParser.json());
这样用了之后登陆会报错“TypeError: Cannot read property 'name' of undefined”
如果写成这样,就OK了
app.use(bodyParser.urlencoded({ extended: true }));
不知道你那边是不是这样子呢?
app.use(bodyParser.urlencoded({ extended: false }));
app.use(bodyParser.json());
这样用了之后登陆会报错“TypeError: Cannot read property 'name' of undefined”
如果写成这样,就OK了
app.use(bodyParser.urlencoded({ extended: true }));
不知道你那边是不是这样子呢?
2015-07-18