app.use(favicon(path.join(__dirname, "static", "favicon.ico")));
if (app.get('env') === 'development')
app.use(favicon(path.join(__dirname, "static", "favicon.ico")));
if (app.get('env') === 'development')
// http://dev.rdybarra.com/2016/06/23/Production-Logging-With-Morgan-In-Express/
app.set('trust proxy', true);
// In prod, only log error responses (https://github.com/expressjs/morgan)
// http://dev.rdybarra.com/2016/06/23/Production-Logging-With-Morgan-In-Express/
app.set('trust proxy', true);
// In prod, only log error responses (https://github.com/expressjs/morgan)
app.use(function(req, res, next) {
res.header("Access-Control-Allow-Origin", params.cors.allowedOrigin);
res.header("Access-Control-Allow-Credentials", true); //for cookies
app.use(function(req, res, next) {
res.header("Access-Control-Allow-Origin", params.cors.allowedOrigin);
res.header("Access-Control-Allow-Credentials", true); //for cookies
// Error handler
app.use(function(err, req, res, next) {
res.status(err.status || 500);
// Error handler
app.use(function(err, req, res, next) {
res.status(err.status || 500);