...
|
...
|
@@ -17,8 +17,8 @@ const path = require('path'); |
|
|
const bodyParser = require('body-parser');
|
|
|
const cookieParser = require('cookie-parser');
|
|
|
const favicon = require('serve-favicon');
|
|
|
const session = require('express-session');
|
|
|
const memcached = require('connect-memcached');
|
|
|
const session = require('yoho-express-session');
|
|
|
const memcached = require('yoho-connect-memcached');
|
|
|
const pkg = require('./package.json');
|
|
|
|
|
|
const app = express();
|
...
|
...
|
@@ -40,17 +40,29 @@ app.use(bodyParser.json()); |
|
|
app.use(bodyParser.urlencoded({extended: false}));
|
|
|
app.use(cookieParser());
|
|
|
app.use(session({
|
|
|
secret: '3e5fec7deca0b8305cefe2ad9d90ff5e',
|
|
|
secret: 'nothing', // 兼容 PHP SESSION,session 不加密
|
|
|
name: 'PHPSESSID',
|
|
|
prefix: 'yohobuy',
|
|
|
genid: () => {
|
|
|
return '2vuiobonflqem9096e15luo045';
|
|
|
},
|
|
|
proxy: true,
|
|
|
resave: true,
|
|
|
resave: false,
|
|
|
saveUninitialized: true,
|
|
|
unset: 'destroy',
|
|
|
store: new MemcachedStore({
|
|
|
hosts: config.memcache.session
|
|
|
hosts: config.memcache.session,
|
|
|
prefix: 'qinsessionsession:', // 兼容 PHP SESSION
|
|
|
key: 'yohobuy_session' // 兼容 PHP SESSION
|
|
|
})
|
|
|
}));
|
|
|
|
|
|
app.use(function(req, res, next) {
|
|
|
console.log(req.session);
|
|
|
console.log(22222, req.session.node, req.session.php);
|
|
|
req.session.node = 'node';
|
|
|
next();
|
|
|
});
|
|
|
|
|
|
// dispatcher
|
|
|
require('./dispatch')(app);
|
|
|
|
...
|
...
|
|