Authored by 徐炜

DNS 预读配置

... ... @@ -99,6 +99,7 @@ try {
const errorHanlder = require('./doraemon/middleware/error-handler');
const setPageInfo = require('./doraemon/middleware/set-pageinfo');
const devtools = require('./doraemon/middleware/devtools');
const layoutTools = require('./doraemon/middleware/layout-tools');
const seo = require('./doraemon/middleware/seo');
const pageCache = require('./doraemon/middleware/page-cache');
... ... @@ -114,6 +115,8 @@ try {
app.use(devtools());
}
app.use(layoutTools());
app.use(pageCache());
require('./dispatch')(app);
app.all('*', errorHanlder.notFound()); // 404
... ...
'use strict';
const fs = require('fs');
const dnsPrefetch = require('../../config/dns-prefetch');
let devHost = '127.0.0.1';
fs.readFile('.devhost', (err, buf)=> {
... ... @@ -14,8 +12,7 @@ fs.readFile('.devhost', (err, buf)=> {
module.exports = () => {
return (req, res, next) => {
Object.assign(res.locals, {
devHost: devHost,
dnsPrefetch: dnsPrefetch
devHost: devHost
});
next();
... ...
'use strict';
const dnsPrefetch = require('../../config/dns-prefetch');
module.exports = () => {
return (req, res, next) => {
Object.assign(res.locals, {
dnsPrefetch: dnsPrefetch
});
next();
};
};
... ...