From 90adfd04aed2f2065d803623c297dc1a8ae71632 Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Sun, 2 Oct 2016 11:57:04 +0100 Subject: [PATCH] add secure middleware for express --- package.json | 3 ++- server.js | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 001866a..def49ee 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,8 @@ "dependencies": { "compression": "=1.6.2", "connect-static-file": "=1.1.2", - "express": "=4.14.0" + "express": "=4.14.0", + "helmet": "=2.3.0" }, "devDependencies": { "eslint": "=1.9.0", diff --git a/server.js b/server.js index 2a728cc..a04ed7d 100644 --- a/server.js +++ b/server.js @@ -1,6 +1,7 @@ const express = require('express'); const staticFile = require('connect-static-file'); const compression = require('compression'); +const helmet = require('helmet'); const path = require('path'); const PORT = process.env.PORT || 5000; @@ -18,6 +19,7 @@ const expressConfig = { const app = express(); app.use(compression({ level: 9 })); +app.use(helmet()); app.use(function (request, response, next) {