...
|
...
|
@@ -15,19 +15,20 @@ var logger = require('morgan'), |
|
|
session = require('express-session'),
|
|
|
connectRedis = require('connect-redis');
|
|
|
|
|
|
var config = require('./config');
|
|
|
|
|
|
var app = express(),
|
|
|
RedisStore = connectRedis(session);
|
|
|
|
|
|
// 向模板注入变量
|
|
|
app.locals.devEnv = app.get('env') === 'development';
|
|
|
var config = require('./config');
|
|
|
|
|
|
// 根据不同环境获取不同配置
|
|
|
if (app.locals.devEnv) {
|
|
|
if (app.get('env') === 'development') {
|
|
|
config = Object.assign(config, require('./config/config.dev'));
|
|
|
}
|
|
|
|
|
|
// 向模板注入变量
|
|
|
app.locals.devEnv = app.get('env') === 'development';
|
|
|
app.locals.assetsUrl = config.assetsUrl;
|
|
|
|
|
|
app.set('trust proxy', ['loopback', 'linklocal', 'uniquelocal']);
|
|
|
app.set('views', path.join(__dirname, 'views/action'));
|
|
|
app.set('view engine', 'hbs');
|
...
|
...
|
|