Authored by 周少峰

auto

Showing 1 changed file with 11 additions and 6 deletions
... ... @@ -30,10 +30,11 @@ const fp = require('lodash/fp');
const pkg = require('./package.json');
const app = express();
const helpers = global.yoho.helpers;
app.get('/test1', (req, res) => {
res.set('Cache-Control', 'no-cache');
res.send('test1');
})
});
app.disable('x-powered-by');
// tdk
... ... @@ -66,7 +67,8 @@ app.set('subdomain offset', 2);
app.get('/test2', (req, res) => {
res.set('Cache-Control', 'no-cache');
res.send('test2');
})
});
// 添加请求上下文
app.use(global.yoho.httpCtx());
... ... @@ -143,10 +145,12 @@ try {
const layoutTools = require('./doraemon/middleware/layout-tools');
const pageCache = require('./doraemon/middleware/page-cache');
const devtool = require('./doraemon/middleware/devtools');
app.get('/test3', (req, res) => {
res.set('Cache-Control', 'no-cache');
res.send('test3');
})
});
// YOHO 前置中间件
app.use(setYohoData());
... ... @@ -158,7 +162,8 @@ try {
app.get('/test4', (req, res) => {
res.set('Cache-Control', 'no-cache');
res.send('test4');
})
});
// 请求限制中间件
if (!app.locals.devEnv) {
app.use(require('./doraemon/middleware/limiter'));
... ... @@ -166,7 +171,7 @@ try {
app.get('/test5', (req, res) => {
res.set('Cache-Control', 'no-cache');
res.send('test5');
})
});
app.use(seo());
app.use(setPageInfo());
app.use(layoutTools());
... ... @@ -178,7 +183,7 @@ try {
app.get('/test6', (req, res) => {
res.set('Cache-Control', 'no-cache');
res.send('test6');
})
});
require('./dispatch')(app);
app.all('*', errorHandler.notFound()); // 404
... ...