...
|
...
|
@@ -3,10 +3,14 @@ |
|
|
* @author: feng.chen<feng.chen@yoho.cn>
|
|
|
* @date: 2017/04/13
|
|
|
*/
|
|
|
'use strict';
|
|
|
|
|
|
const bodyParser = require('body-parser');
|
|
|
const cookieParser = require('cookie-parser');
|
|
|
const Express = require('express');
|
|
|
const session = require('express-session')
|
|
|
const session = require('express-session');
|
|
|
const config = require('./common/config');
|
|
|
const logger = require('yoho-node-lib/lib/logger');
|
|
|
const logger = require('yoho-node-lib/lib/logger').init(config);
|
|
|
const helpers = require('yoho-node-lib/lib/helpers');
|
|
|
const middleware = require('./middleware');
|
|
|
const controllers = require('./controllers');
|
...
|
...
|
@@ -23,19 +27,23 @@ app.use(session({ |
|
|
secret: 'yoho!shop@manage'
|
|
|
}));
|
|
|
|
|
|
app.use(bodyParser.json());
|
|
|
app.use(bodyParser.urlencoded({extended: false}));
|
|
|
app.use(cookieParser());
|
|
|
|
|
|
try {
|
|
|
// 前置中间件
|
|
|
app.use(middleware.before);
|
|
|
//app.use(middleware.before);
|
|
|
|
|
|
// controller
|
|
|
app.use(controllers);
|
|
|
|
|
|
// // 后置中间件
|
|
|
app.use(middleware.auth);
|
|
|
app.use(middleware.proxy);
|
|
|
//app.use(middleware.auth);
|
|
|
//app.use(middleware.proxy);
|
|
|
|
|
|
// // 异常捕获中间件
|
|
|
app.use(middleware.error);
|
|
|
//app.use(middleware.error);
|
|
|
} catch (err) {
|
|
|
logger.error(err);
|
|
|
}
|
...
|
...
|
|