Authored by 郭成尧

add-isApmReport

Showing 1 changed file with 4 additions and 5 deletions
@@ -104,19 +104,18 @@ app.use(compression()); @@ -104,19 +104,18 @@ app.use(compression());
104 104
105 require('./doraemon/middleware/yoho-session')(app); 105 require('./doraemon/middleware/yoho-session')(app);
106 106
  107 +// 添加请求上下文
  108 +app.use(global.yoho.httpCtx());
  109 +
107 app.use((req, res, next) => { 110 app.use((req, res, next) => {
108 req.user = {}; // 全局的用户数据 111 req.user = {}; // 全局的用户数据
109 req.yoho = {}; // req和res绑定yoho对象,用于传递全局数据, 如req.yoho.channel等 112 req.yoho = {}; // req和res绑定yoho对象,用于传递全局数据, 如req.yoho.channel等
110 req.app.locals.wap = app.locals.wap; // zookeper对象赋值 113 req.app.locals.wap = app.locals.wap; // zookeper对象赋值
111 114
  115 + req.isApmReport = app.locals.wap.open.bughd; // 把错误上报的开关绑定到上下文,node-lib 库要使用
112 next(); 116 next();
113 }); 117 });
114 118
115 -// 添加请求上下文  
116 -app.use(global.yoho.httpCtx());  
117 -  
118 -// redis seo  
119 -  
120 // dispatcher 119 // dispatcher
121 try { 120 try {
122 const tdkUrl = require('./doraemon/middleware/redis-url'); 121 const tdkUrl = require('./doraemon/middleware/redis-url');