...
|
...
|
@@ -16,6 +16,7 @@ const path = require('path'); |
|
|
const bodyParser = require('body-parser');
|
|
|
const cookieParser = require('cookie-parser');
|
|
|
const favicon = require('serve-favicon');
|
|
|
const uuid = require('uuid');
|
|
|
|
|
|
const pkg = require('./package.json');
|
|
|
const session = require('cookie-session');
|
...
|
...
|
@@ -66,6 +67,12 @@ app.use((req, res, next) => { |
|
|
req.user = {}; // 全局的用户数据
|
|
|
req.yoho = {}; // req和res绑定yoho对象,用于传递全局数据, 如req.yoho.channel等
|
|
|
|
|
|
if (!req.session.id) {
|
|
|
req.session.id = uuid.v4();
|
|
|
}
|
|
|
|
|
|
req.sessionID = req.session.id;
|
|
|
|
|
|
next();
|
|
|
});
|
|
|
|
...
|
...
|
|