...
|
...
|
@@ -27,7 +27,7 @@ const _ = require('lodash'); |
|
|
|
|
|
const uuid = require('uuid');
|
|
|
|
|
|
const redisStore = redis(session);
|
|
|
const RedisStore = redis(session);
|
|
|
|
|
|
// 全局注册library
|
|
|
yohoLib.global(config);
|
...
|
...
|
@@ -50,6 +50,16 @@ exports.createApp = async (app) => { |
|
|
app.use(devtools());
|
|
|
}
|
|
|
|
|
|
app.use('/crm/common/ok.jsp', (req, res) => {
|
|
|
res.status(200).end();
|
|
|
});
|
|
|
app.head('*', (req, res) => {
|
|
|
res.status(200).end();
|
|
|
});
|
|
|
|
|
|
app.use(favicon(path.join(__dirname, '/public/favicon.ico')));
|
|
|
app.use(express.static(path.join(__dirname, 'public')));
|
|
|
|
|
|
// 添加请求上下文
|
|
|
app.use(global.yoho.httpCtx());
|
|
|
|
...
|
...
|
@@ -63,8 +73,6 @@ exports.createApp = async (app) => { |
|
|
helpers: _.assign(global.yoho.helpers, require('./utils/helpers'))
|
|
|
}));
|
|
|
|
|
|
app.use(favicon(path.join(__dirname, '/public/favicon.ico')));
|
|
|
app.use(express.static(path.join(__dirname, 'public')));
|
|
|
app.use(bodyParser.json());
|
|
|
app.use(bodyParser.urlencoded({
|
|
|
extended: true
|
...
|
...
|
@@ -77,12 +85,12 @@ exports.createApp = async (app) => { |
|
|
saveUninitialized: true,
|
|
|
unset: 'destroy',
|
|
|
secret: '82dd7e724f2c6870472c89dfa43cf48d',
|
|
|
name: 'yohoblk_session',
|
|
|
name: 'yohoblk_session2',
|
|
|
cookie: {
|
|
|
domain: 'yohoblk.com',
|
|
|
httpOnly: false
|
|
|
},
|
|
|
store: new redisStore(config.redis.session)
|
|
|
store: new RedisStore(config.redis.session)
|
|
|
}));
|
|
|
|
|
|
app.use((req, res, next) => {
|
...
|
...
|
@@ -115,10 +123,6 @@ exports.createApp = async (app) => { |
|
|
await require('./doraemon/middleware/ssr')(app);
|
|
|
require('./dispatch')(app);
|
|
|
|
|
|
app.use('/crm/common/ok.jsp', (req, res) => {
|
|
|
res.status(204).end();
|
|
|
});
|
|
|
|
|
|
app.all('*', errorHanlder.notFound()); // 404
|
|
|
|
|
|
// YOHO 后置中间件
|
...
|
...
|
|