mirror of
https://github.com/zhigang1992/deployd.git
synced 2026-05-16 02:57:25 +08:00
21 lines
358 B
JavaScript
21 lines
358 B
JavaScript
/**
|
|
* Dependencies
|
|
*/
|
|
|
|
var sessions = require('./collections/sessions');
|
|
|
|
module.exports = function (req, res, next) {
|
|
var sid = req.cookies.sid;
|
|
|
|
if(req.cookies.sid) {
|
|
sessions.get({_id: sid}).first(function (err, session) {
|
|
if(session) {
|
|
req.session = session;
|
|
}
|
|
|
|
next(err);
|
|
})
|
|
} else {
|
|
next();
|
|
}
|
|
} |