diff --git a/app.js b/app.js index 8f643b3b34..feaa0ab007 100644 --- a/app.js +++ b/app.js @@ -12,28 +12,22 @@ module.exports = function(config) { var router = express.Router(); // eslint-disable-line var baseUriPath = config.baseUriPath || ''; - app.use(favicon(__dirname + '/public/favicon.ico')); - - app.use(validator([])); - app.set('trust proxy'); + app.set('port', config.port); app.locals.baseUriPath = baseUriPath; + app.use(cookieParser()); + app.use(favicon(__dirname + '/public/favicon.ico')); + app.use(validator([])); + app.use(baseUriPath, express.static(__dirname + '/public')); + app.use(bodyParser.json({ strict: false })); app.use(log4js.connectLogger(logger, { format: ':remote-addr :status :method :url :response-timems', level: 'auto' // 3XX=WARN, 4xx/5xx=ERROR })); - app.set('port', config.port); - - app.use(baseUriPath, express.static(__dirname + '/public')); - app.use(bodyParser.json({ strict: false })); - - app.use(cookieParser()); - // Setup API routes routes.create(router, config); - app.use(baseUriPath, router); return app;