X-Git-Url: https://git.auder.net/pieces/Checkered/cp.svg?a=blobdiff_plain;f=server%2Fapp.js;h=df15fa20ed4f2902ba1b31fcce2d15f99a1d142b;hb=7ebc0408a76b4a966273190a2ade49e0f97099be;hp=785088b3fe6e889cabdd9cb622240d145f3c1367;hpb=7c42b2ff7b431f49c4ab8cfb97ed5a51a6574586;p=vchess.git diff --git a/server/app.js b/server/app.js index 785088b3..df15fa20 100644 --- a/server/app.js +++ b/server/app.js @@ -11,12 +11,9 @@ let app = express(); app.use(favicon(path.join(__dirname, "static", "favicon.ico"))); if (app.get('env') === 'development') -{ // Full logging in development mode app.use(logger('dev')); -} -else -{ +else { // 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) @@ -34,8 +31,7 @@ app.use(express.static(path.join(__dirname, 'static'))); app.use(express.static(path.join(__dirname, 'fallback'))); // In development stage the client side has its own server -if (params.cors.enable) -{ +if (params.cors.enable) { app.use(function(req, res, next) { res.header("Access-Control-Allow-Origin", params.cors.allowedOrigin); res.header("Access-Control-Allow-Credentials", true); //for cookies @@ -63,8 +59,7 @@ app.use(function(req, res, next) { // Error handler app.use(function(err, req, res, next) { res.status(err.status || 500); - if (app.get('env') === 'development') - console.log(err.stack); + if (app.get('env') === 'development') console.log(err.stack); res.send( "