From 4fddbb7b2f0204f6c79cc1749cf96c4feef4bfb9 Mon Sep 17 00:00:00 2001 From: Froilan Irizarry Date: Sat, 13 Apr 2019 19:29:02 -0400 Subject: [PATCH] Fixed requirements bug. Added helmet middleware usage --- app.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/app.js b/app.js index 8b510c7..e8cada9 100644 --- a/app.js +++ b/app.js @@ -8,6 +8,7 @@ const cookieParser = require('cookie-parser'); const logger = require('morgan'); var cors = require('cors'); const RateLimit = require('express-rate-limit'); +const helmet = require('helmet'); const indexRouter = require('./routes/index'); const usersRouter = require('./routes/users'); @@ -22,7 +23,7 @@ const limiter = new RateLimit({ headers: true }); app.use(limiter); - +app.use(helmet()); app.use(function(req, res, next) { res.setHeader('Server', ''); res.setHeader('Via', ''); @@ -30,10 +31,7 @@ app.use(function(req, res, next) { }); app.use(helmet.hsts({ maxAge: 31536000, - preload: false, - setIf: function() { - return process.env.NODE_ENV === 'local' ? false : true; - } + preload: false })); // view engine setup