...
|
...
|
@@ -45,7 +45,6 @@ const logger = global.yoho.logger; |
|
|
|
|
|
// tdk
|
|
|
global.yoho.redis = require('./doraemon/middleware/redis');
|
|
|
const tdk = require('./utils/getTDK');
|
|
|
|
|
|
// zookeeper
|
|
|
if (config.zookeeperServer) {
|
...
|
...
|
@@ -181,25 +180,10 @@ app.use((req, res, next) => { |
|
|
app.use(global.yoho.httpCtx());
|
|
|
|
|
|
// redis seo
|
|
|
app.use((req, res, next) => {
|
|
|
if (!req.xhr) {
|
|
|
tdk('url', `${req.hostname}${req.originalUrl}`, req).then(TDKObj =>{
|
|
|
if (TDKObj[0]) {
|
|
|
req.tdk = {
|
|
|
title: TDKObj[1],
|
|
|
keywords: TDKObj[2],
|
|
|
description: TDKObj[3]
|
|
|
};
|
|
|
}
|
|
|
next();
|
|
|
});
|
|
|
} else {
|
|
|
return next();
|
|
|
}
|
|
|
});
|
|
|
|
|
|
// dispatcher
|
|
|
try {
|
|
|
const tdkUrl = require('./doraemon/middleware/redis-url');
|
|
|
const user = require('./doraemon/middleware/user');
|
|
|
const reqParamsFilter = require('./doraemon/middleware/req-params-filter');
|
|
|
const urlRewrite = require('./doraemon/middleware/url-rewrite');
|
...
|
...
|
@@ -214,6 +198,7 @@ try { |
|
|
const pageCache = require('./doraemon/middleware/page-cache');
|
|
|
|
|
|
// YOHO 前置中间件
|
|
|
app.use(tdkUrl());
|
|
|
app.use(reqParamsFilter());
|
|
|
app.use(urlRewrite());
|
|
|
app.use(subDomain());
|
...
|
...
|
|