add secure middleware for express

This commit is contained in:
Jake Howard 2016-10-02 11:57:04 +01:00
parent 55974bb55d
commit 90adfd04ae
Signed by: jake
GPG key ID: 57AFB45680EDD477
2 changed files with 4 additions and 1 deletions

View file

@ -22,7 +22,8 @@
"dependencies": { "dependencies": {
"compression": "=1.6.2", "compression": "=1.6.2",
"connect-static-file": "=1.1.2", "connect-static-file": "=1.1.2",
"express": "=4.14.0" "express": "=4.14.0",
"helmet": "=2.3.0"
}, },
"devDependencies": { "devDependencies": {
"eslint": "=1.9.0", "eslint": "=1.9.0",

View file

@ -1,6 +1,7 @@
const express = require('express'); const express = require('express');
const staticFile = require('connect-static-file'); const staticFile = require('connect-static-file');
const compression = require('compression'); const compression = require('compression');
const helmet = require('helmet');
const path = require('path'); const path = require('path');
const PORT = process.env.PORT || 5000; const PORT = process.env.PORT || 5000;
@ -18,6 +19,7 @@ const expressConfig = {
const app = express(); const app = express();
app.use(compression({ level: 9 })); app.use(compression({ level: 9 }));
app.use(helmet());
app.use(function (request, response, next) { app.use(function (request, response, next) {