Authored by 徐祁xuqi

use zookeeper

... ... @@ -27,6 +27,11 @@ const app = express();
app.locals.devEnv = app.get('env') === 'development';
app.locals.version = pkg.version;
// zookeeper
if (config.zookeeperServer) {
require('yoho-zookeeper')(config.zookeeperServer, 'wap', app.locals.wap = {});
}
// 访问域名层级
app.set('subdomain offset', 3);
... ...
... ... @@ -27,6 +27,13 @@ app.use(global.yoho.hbs({
helpers: Object.assign({}, global.yoho.helpers, helpers)
}));
// for zookeeper, inject locals
app.use((req, res, next) => {
req.app.locals.wap = app.locals.wap;
next();
});
// router
app.use(require('./router'));
... ...
... ... @@ -15,6 +15,13 @@ app.on('mount', function(parent) {
Object.assign(app.locals, parent.locals);
});
// for zookeeper, inject locals
app.use((req, res, next) => {
req.app.locals.wap = app.locals.wap;
next();
});
// router
app.use(require('./router'));
... ...
... ... @@ -4,27 +4,21 @@
* @date: 2016/05/09
*/
var express = require('express'),
path = require('path');
var express = require('express');
var app = express();
// set view engin
var doraemon = path.join(__dirname, '../../doraemon/views'); // parent view root
app.on('mount', function(parent) {
delete parent.locals.settings; // 不继承父 App 的设置
Object.assign(app.locals, parent.locals);
});
// app.use(global.yoho.hbs({
// extname: '.hbs',
// defaultLayout: 'layout',
// layoutsDir: doraemon,
// partialsDir: path.join(__dirname, 'views/partial'),
// views: path.join(__dirname, 'views/action'),
// helpers: global.yoho.helpers
// }));
// for zookeeper, inject locals
app.use((req, res, next) => {
req.app.locals.wap = app.locals.wap;
next();
});
// router
app.use(require('./router'));
... ...
... ... @@ -26,6 +26,13 @@ app.use(global.yoho.hbs({
helpers: global.yoho.helpers
}));
// for zookeeper, inject locals
app.use((req, res, next) => {
req.app.locals.wap = app.locals.wap;
next();
});
// router
app.use(require('./router'));
... ...
... ... @@ -26,6 +26,13 @@ app.use(global.yoho.hbs({
helpers: global.yoho.helpers
}));
// for zookeeper, inject locals
app.use((req, res, next) => {
req.app.locals.wap = app.locals.wap;
next();
});
// router
app.use(require('./router'));
... ...
... ... @@ -26,6 +26,13 @@ app.use(global.yoho.hbs({
helpers: global.yoho.helpers
}));
// for zookeeper, inject locals
app.use((req, res, next) => {
req.app.locals.wap = app.locals.wap;
next();
});
// router
app.use(require('./router'));
... ...
... ... @@ -28,6 +28,12 @@ app.use(global.yoho.hbs({
helpers: global.yoho.helpers
}));
// for zookeeper, inject locals
app.use((req, res, next) => {
req.app.locals.wap = app.locals.wap;
next();
});
require('./auth');
app.use(passport.initialize());
... ...
... ... @@ -27,6 +27,13 @@ app.use(global.yoho.hbs({
helpers: global.yoho.helpers
}));
// for zookeeper, inject locals
app.use((req, res, next) => {
req.app.locals.wap = app.locals.wap;
next();
});
// router
app.use(require('./router'));
... ...
... ... @@ -2,5 +2,7 @@
<a href="{{@root.cartUrl}}">
<span class="iconfont">&#xe62c;</span>
</a>
{{#unless @root.wap.common.removeCartCount}}
<span class="cart-count hide">0</span>
{{/unless}}
</div>
... ...
... ... @@ -38,7 +38,8 @@
"request-promise": "^3.0.0",
"serve-favicon": "^2.3.0",
"uuid": "^2.0.3",
"yoho-node-lib": "0.1.22"
"yoho-node-lib": "0.1.22",
"yoho-zookeeper": "^1.0.3"
},
"devDependencies": {
"autoprefixer": "^6.3.7",
... ...