...
|
...
|
@@ -71,6 +71,14 @@ app.set('json replacer', function(key, value) { |
|
|
return value;
|
|
|
});
|
|
|
|
|
|
app.use((req, res, next) => {
|
|
|
req.isApmReport = _.get(req.app.locals, 'pc.open.bughd', false);
|
|
|
next();
|
|
|
});
|
|
|
|
|
|
// 添加请求上下文
|
|
|
app.use(global.yoho.httpCtx());
|
|
|
|
|
|
// 请求限制中间件
|
|
|
if (!app.locals.devEnv) {
|
|
|
app.use(require('./doraemon/middleware/limiter'));
|
...
|
...
|
@@ -79,9 +87,6 @@ if (!app.locals.devEnv) { |
|
|
// 指定libray目录
|
|
|
global.utils = path.resolve('./utils');
|
|
|
|
|
|
// 添加请求上下文
|
|
|
app.use(global.yoho.httpCtx());
|
|
|
|
|
|
// 访问域名层级
|
|
|
app.set('subdomain offset', 3);
|
|
|
|
...
|
...
|
@@ -105,9 +110,6 @@ app.use(compression()); |
|
|
|
|
|
require('./doraemon/middleware/yoho-session')(app);
|
|
|
|
|
|
// 添加请求上下文
|
|
|
app.use(global.yoho.httpCtx());
|
|
|
|
|
|
app.use((req, res, next) => {
|
|
|
req.user = {}; // 全局的用户数据
|
|
|
req.yoho = {}; // req和res绑定yoho对象,用于传递全局数据, 如req.yoho.channel等
|
...
|
...
|
|