...
|
...
|
@@ -20,9 +20,12 @@ var config = require('./config'); |
|
|
var app = express(),
|
|
|
RedisStore = connectRedis(session);
|
|
|
|
|
|
// 根据不同配置获取不同配置
|
|
|
if (app.get('env') === 'development') {
|
|
|
config = Object.assign(config, require('./config.dev'));
|
|
|
// 向模板注入变量
|
|
|
app.locals.devEnv = app.get('env') === 'development';
|
|
|
|
|
|
// 根据不同环境获取不同配置
|
|
|
if (app.locals.devEnv) {
|
|
|
config = Object.assign(config, require('./config/config.dev'));
|
|
|
}
|
|
|
|
|
|
app.set('trust proxy', ['loopback', 'linklocal', 'uniquelocal']);
|
...
|
...
|
@@ -48,9 +51,6 @@ app.use(session({ |
|
|
secret: config.sessionSecret
|
|
|
}));
|
|
|
|
|
|
// 向模板注入变量
|
|
|
app.locals.devEnv = app.get('env') === 'development';
|
|
|
|
|
|
// 加载路由
|
|
|
app.use('/', require('./router'));
|
|
|
|
...
|
...
|
|