Authored by htoooth

zookeeper

... ... @@ -13,6 +13,8 @@ const bodyParser = require('body-parser');
const cookieParser = require('cookie-parser');
const favicon = require('serve-favicon');
const session = require('yoho-express-session');
const _ = require('lodash');
const fp = require('lodash/fp');
const memcached = require('connect-memcached');
const hbs = require('express-handlebars');
... ... @@ -27,15 +29,24 @@ const MemcachedStore = memcached(session);
// 全局注册library
yohoLib.global(config);
const helpers = global.yoho.helpers;
// NOTE: 这里修改了图片质量的参数
helpers.image = _.flow(helpers.image, fp.replace(/\/quality\/\d*$/, '/quality/90'));
helpers.json = JSON.stringify;
global.middleware = path.resolve('./doraemon/middleware');
global.utils = path.resolve('./utils');
// 向模板注入变量
app.locals.devEnv = app.get('env') === 'development';
app.locals.version = pkg.version;
app.locals.__YOHO_CONFIG = {};
// zookeeper设置
require('yoho-zookeeper')(config.zookeeperServer, 'pc', app.locals);
require('yoho-zookeeper')(config.zookeeperServer, 'pc', app.locals.__YOHO_CONFIG);
console.log(app.locals.__YOHO_CONFIG);
app.set('subdomain offset', 2);
app.set('view engine', '.hbs');
... ...
... ... @@ -29,6 +29,12 @@
{{{body}}}
{{/if}}
{{> footer}}
<!--降级配置-->
<stript>
var __YOHO_CONFIG = {{{json __YOHO_CONFIG}}}
</stript>
{{#if devEnv}}
<script src="//localhost:5002/libs.js"></script>
<script src="//localhost:5002/{{module}}.{{page}}.js"></script>
... ...
... ... @@ -16,9 +16,6 @@ const itemFromBase = {
saleSpecial: {domain: 'sale', module: 's'}// sale.yohobuy.com
};
// NOTE: 这里修改了图片质量的参数
helpers.image = _.flow(helpers.image, fp.replace(/\/quality\/\d*$/, '/quality/90'));
/**
* 根据性别来决定 默认图片获取字段 如果是 2、3
*
... ...