Merge pull request #100 from mozilla/helmet

Added Helmet Middleware
This commit is contained in:
Abhinav Adduri 2017-06-20 10:54:44 -07:00 committed by GitHub
commit 9495dba5ad
2 changed files with 4 additions and 2 deletions

View file

@ -13,6 +13,7 @@
"express": "^4.15.3", "express": "^4.15.3",
"express-handlebars": "^3.0.0", "express-handlebars": "^3.0.0",
"fs-extra": "^3.0.1", "fs-extra": "^3.0.1",
"helmet": "^3.6.1",
"jquery": "^3.2.1", "jquery": "^3.2.1",
"mozlog": "^2.1.1", "mozlog": "^2.1.1",
"node-fetch": "^1.7.1", "node-fetch": "^1.7.1",

View file

@ -3,6 +3,7 @@ const exphbs = require('express-handlebars');
const busboy = require('connect-busboy'); const busboy = require('connect-busboy');
const path = require('path'); const path = require('path');
const bodyParser = require('body-parser'); const bodyParser = require('body-parser');
const helmet = require('helmet');
const bytes = require('bytes'); const bytes = require('bytes');
const conf = require('./config.js'); const conf = require('./config.js');
const storage = require('./storage.js'); const storage = require('./storage.js');
@ -18,9 +19,9 @@ const app = express();
app.engine('handlebars', exphbs({ defaultLayout: 'main' })); app.engine('handlebars', exphbs({ defaultLayout: 'main' }));
app.set('view engine', 'handlebars'); app.set('view engine', 'handlebars');
app.use(helmet());
app.use(busboy()); app.use(busboy());
app.use(bodyParser.json()); app.use(bodyParser.json());
app.use(express.static(path.join(__dirname, '../public'))); app.use(express.static(path.join(__dirname, '../public')));
app.get('/', (req, res) => { app.get('/', (req, res) => {
@ -103,7 +104,7 @@ app.post('/delete/:id', (req, res) => {
storage storage
.delete(id, delete_token) .delete(id, delete_token)
.then(() => { .then((err) => {
if (!err) { if (!err) {
log.info('Deleted:', id); log.info('Deleted:', id);
res.sendStatus(200); res.sendStatus(200);