From 9534d3fc6ca9e80cf237f764de0a23a5cc9d04ea Mon Sep 17 00:00:00 2001 From: yyq <kingcoon@163.com> Date: Fri, 1 Nov 2019 16:49:01 +0800 Subject: [PATCH] page name & favicon --- config/ssr-routes.js | 3 +++ create-app.js | 2 ++ doraemon/middleware/ssr.js | 1 + favicon.ico | Bin 1150 -> 0 bytes 4 files changed, 6 insertions(+), 0 deletions(-) diff --git a/config/ssr-routes.js b/config/ssr-routes.js index 7e67c89..83277e4 100644 --- a/config/ssr-routes.js +++ b/config/ssr-routes.js @@ -3,15 +3,18 @@ module.exports = [ route: /xianyu\/index\/channel/, cacheTime: 60, cache: true, + pageName: 'channel' }, { route: /xianyu\/index/, cacheTime: 60, cache: true, + pageName: 'channel' }, { route: /xianyu\/index\/category/, cacheTime: 30, cache: true, + pageName: 'category' }, ]; diff --git a/create-app.js b/create-app.js index f3943bc..90e7928 100644 --- a/create-app.js +++ b/create-app.js @@ -8,6 +8,7 @@ const pkg = require('./package.json'); const devtools = require('./doraemon/middleware/devtools'); const _ = require('lodash'); const uuid = require('uuid'); +const favicon = require('serve-favicon'); // 全局注册library yohoLib.global(config); @@ -38,6 +39,7 @@ exports.createApp = async(app) => { } app.set('etag', false); + app.use(favicon(path.join(__dirname, './favicon.ico'))); app.use('/xianyu/node/status.html', (req, res) => { res.status(200).end(); diff --git a/doraemon/middleware/ssr.js b/doraemon/middleware/ssr.js index 0070530..c373aff 100644 --- a/doraemon/middleware/ssr.js +++ b/doraemon/middleware/ssr.js @@ -140,6 +140,7 @@ const render = (route) => { app: config.appName, ip: req.yoho.clientIp, path: req.url, + pageName: _.get(route, 'pageName', 'unknown'), uid: req.user.uid, udid: req.cookies.udid || '', clientType: req.yoho.clientType || '', diff --git a/favicon.ico b/favicon.ico index f559cca..95ee98b 100644 Binary files a/favicon.ico and b/favicon.ico differ -- libgit2 0.24.0