...
|
...
|
@@ -71,6 +71,14 @@ app.set('json replacer', function(key, value) { |
|
|
return value;
|
|
|
});
|
|
|
|
|
|
app.use((req, res, next) => {
|
|
|
req.isApmReport = _.get(req.app.locals, 'wap.open.bughd', false); // 把错误上报的开关绑定到上下文,node-lib 库要使用
|
|
|
next();
|
|
|
});
|
|
|
|
|
|
// 添加请求上下文
|
|
|
app.use(global.yoho.httpCtx());
|
|
|
|
|
|
// 请求限制中间件
|
|
|
if (!app.locals.devEnv) {
|
|
|
app.use(require('./doraemon/middleware/limiter'));
|
...
|
...
|
@@ -107,8 +115,6 @@ app.use((req, res, next) => { |
|
|
req.yoho = {}; // req和res绑定yoho对象,用于传递全局数据, 如req.yoho.channel等
|
|
|
req.app.locals.wap = app.locals.wap; // zookeper对象赋值
|
|
|
|
|
|
req.isApmReport = app.locals.wap.open && app.locals.wap.open.bughd; // 把错误上报的开关绑定到上下文,node-lib 库要使用
|
|
|
|
|
|
// 独立的 UDID
|
|
|
if (!req.cookies.udid) {
|
|
|
res.cookie('udid', uuid.v4(), {
|
...
|
...
|
|