Authored by ccbikai

Merge branch 'feature/session' into develop

... ... @@ -17,8 +17,9 @@ 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 uuid = require('uuid');
const pkg = require('./package.json');
const app = express();
... ... @@ -40,14 +41,19 @@ app.use(bodyParser.json());
app.use(bodyParser.urlencoded({extended: false}));
app.use(cookieParser());
app.use(session({
secret: '3e5fec7deca0b8305cefe2ad9d90ff5e',
name: 'PHPSESSID',
prefix: 'yohobuy',
secret: 'nothing', // 兼容 PHP SESSION,sessionID 不加密
name: 'PHPSESSID', // 兼容 PHP SESSION
genid: () => {
return uuid.v4(); // 兼容 PHP SESSION
},
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
})
}));
... ...
... ... @@ -30,30 +30,30 @@
},
"license": "MIT",
"dependencies": {
"bluebird": "^3.3.5",
"bluebird": "^3.4.0",
"body-parser": "^1.15.0",
"connect-memcached": "^0.2.0",
"cookie-parser": "^1.4.1",
"express": "^4.13.1",
"express-handlebars": "^3.0.0",
"express-session": "^1.13.0",
"influxdb-winston": "^1.0.1",
"lodash": "^4.12.0",
"md5": "^2.1.0",
"memcached": "^2.2.1",
"memcached": "^2.2.2",
"morgan": "^1.7.0",
"oneapm": "^1.2.20",
"request-promise": "^3.0.0",
"serve-favicon": "^2.3.0",
"uuid": "^2.0.2",
"winston": "^2.2.0",
"winston-daily-rotate-file": "^1.0.1"
"winston-daily-rotate-file": "^1.0.1",
"yoho-connect-memcached": "^1.0.3",
"yoho-express-session": "^1.0.2"
},
"devDependencies": {
"autoprefixer": "^6.3.6",
"ava": "^0.14.0",
"babel-cli": "^6.8.0",
"babel-preset-es2015": "^6.6.0",
"babel-register": "^6.8.0",
"babel-preset-es2015": "^6.9.0",
"babel-register": "^6.9.0",
"eslint": "^2.10.2",
"eslint-config-yoho": "^1.0.1",
"gulp": "^3.9.1",
... ... @@ -63,7 +63,6 @@
"gulp-sourcemaps": "^2.0.0-alpha",
"gulp-util": "^3.0.7",
"husky": "^0.11.4",
"mocha": "^2.4.5",
"nodemon": "1.9.2",
"nyc": "^6.4.3",
"postcss-assets": "^4.0.1",
... ... @@ -81,7 +80,7 @@
"precss": "^1.4.0",
"rewire": "^2.5.1",
"shelljs": "^0.7.0",
"stylelint": "^6.3.3",
"stylelint": "^6.4.1",
"stylelint-config-yoho": "^1.2.3",
"webpack": "^1.13.0",
"webpack-dev-server": "^1.14.1",
... ...