Skip to content

Commit 4cfcf2a

Browse files
committed
Added helmet manage security header
1 parent 4633ab8 commit 4cfcf2a

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
"dotenv": "^6.2.0",
1212
"express": "^4.16.4",
1313
"express-jwt": "^5.3.1",
14+
"helmet": "^3.15.1",
1415
"joi": "^14.3.1",
1516
"jsonwebtoken": "^8.4.0",
1617
"mongoose": "^5.4.10"
@@ -42,7 +43,7 @@
4243
"lint": "./node_modules/.bin/eslint 'index.js' 'server/**/*.js' 'server/app.js' ",
4344
"precommit": "npm run lint",
4445
"prepush": "npm run lint",
45-
"test:coverage":"nyc --reporter=lcov yarn test"
46+
"test:coverage": "nyc --reporter=lcov yarn test"
4647
},
4748
"repository": {
4849
"type": "git",

server/app.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,14 @@ import { connectMongo } from './config/mongoconnect'
44
import { errorHandler } from './config/errorHandler'
55
import bodyParser from 'body-parser'
66
import jwt from 'express-jwt'
7+
import helmet from 'helmet'
78
import { httpStatus } from './utils/httpStatus'
89
import { AppError } from './utils/appError'
910
import { secretCallback } from './utils/secretCallback'
1011
const app = express()
1112

1213
app.use(bodyParser.json())
14+
app.use(helmet())
1315
app.use(jwt({ secret: secretCallback }).unless({ path: [ '/api/health-check', '/api/users', '/api/auth/login' ], requestProperty: 'auth' }))
1416
app.use('/api', Router)
1517

0 commit comments

Comments
 (0)