set-pageinfo.js
416 Bytes
/**
* 设置页面的module,page默认值
* @author: 赵彪<bill.zhao@yoho.cn>
* @date: 2016/6/22
*/
'use strict';
module.exports = () => {
return (req, res, next) => {
if (!req.xhr) {
let arr = req.path.substring(1).split('/');
Object.assign(res.locals, {
module: arr[0],
page: arr[1]
});
}
next();
};
};