...
|
...
|
@@ -25,7 +25,7 @@ const pkg = require('./package.json'); |
|
|
const yohoLib = require('yoho-node-lib');
|
|
|
|
|
|
const app = express();
|
|
|
// const MemcachedStore = memcached(session);
|
|
|
const MemcachedStore = memcached(session);
|
|
|
|
|
|
// 全局注册library
|
|
|
yohoLib.global(config);
|
...
|
...
|
@@ -53,22 +53,22 @@ app.use(bodyParser.json()); |
|
|
app.use(bodyParser.urlencoded({extended: false}));
|
|
|
app.use(cookieParser());
|
|
|
|
|
|
// app.use(session({
|
|
|
// proxy: true,
|
|
|
// resave: false,
|
|
|
// saveUninitialized: true,
|
|
|
// unset: 'destroy',
|
|
|
// secret: '82dd7e724f2c6870472c89dfa43cf48d',
|
|
|
// name: 'yohoblk-session',
|
|
|
// cookie: {
|
|
|
// domain: 'yohoblk.com',
|
|
|
// httpOnly: false
|
|
|
// },
|
|
|
// store: new MemcachedStore({
|
|
|
// hosts: config.memcache.session,
|
|
|
// prefix: 'yohoblk_session:'
|
|
|
// })
|
|
|
// }));
|
|
|
app.use(session({
|
|
|
proxy: true,
|
|
|
resave: false,
|
|
|
saveUninitialized: true,
|
|
|
unset: 'destroy',
|
|
|
secret: '82dd7e724f2c6870472c89dfa43cf48d',
|
|
|
name: 'yohoblk-session',
|
|
|
cookie: {
|
|
|
domain: 'yohoblk.com',
|
|
|
httpOnly: false
|
|
|
},
|
|
|
store: new MemcachedStore({
|
|
|
hosts: config.memcache.session,
|
|
|
prefix: 'yohoblk_session:'
|
|
|
})
|
|
|
}));
|
|
|
|
|
|
app.use((req, res, next) => {
|
|
|
req.user = {}; // 全局的用户数据
|
...
|
...
|
@@ -107,5 +107,5 @@ try { |
|
|
|
|
|
// listener
|
|
|
app.listen(config.port, function() {
|
|
|
logger.info('yohobuy start');
|
|
|
logger.info('yohoblk start');
|
|
|
}); |
...
|
...
|
|