...
|
...
|
@@ -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');
|
...
|
...
|
|