Authored by biao

add set page info

... ... @@ -86,12 +86,14 @@ try {
const seo = require('./doraemon/middleware/seo');
const setYohoData = require('./doraemon/middleware/set-yoho-data');
const errorHanlder = require('./doraemon/middleware/error-handler');
const setPageInfo = require('./doraemon/middleware/set-pageinfo');
// YOHO 前置中间件
app.use(mobileCheck());
app.use(setYohoData());
app.use(user());
app.use(seo());
app.use(setPageInfo());
require('./dispatch')(app);
... ...
/**
* 设置页面的module,page默认值
* @author: 赵彪<bill.zhao@yoho.cn>
* @date: 2016/6/22
*/
'use strict';
module.exports = () => {
return (req, res, next) => {
if (!req.xhr) {
const arr = req.path.substring(1).split('/');
Object.assign(res.locals, {
module: arr[0],
page: arr[1]
});
}
next();
};
};
... ...