Skip to content

Commit

Permalink
Adding compression and helmet
Browse files Browse the repository at this point in the history
  • Loading branch information
hgorges committed Sep 3, 2024
1 parent 2a819ce commit 076f046
Show file tree
Hide file tree
Showing 3 changed files with 95 additions and 0 deletions.
85 changes: 85 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,14 @@
"devDependencies": {
"@doist/todoist-api-typescript": "^3.0.2",
"@types/bcrypt": "^5.0.0",
"@types/compression": "^1.7.5",
"@types/connect-flash": "^0.0.40",
"@types/cookie-parser": "^1.4.7",
"@types/cors": "^2.8.14",
"@types/ejs": "^3.1.5",
"@types/express": "^4.17.18",
"@types/express-session": "^1.17.10",
"@types/helmet": "^4.0.0",
"@types/jest": "^29.5.11",
"@types/json-schema": "^7.0.15",
"@types/node": "^20.10.7",
Expand Down Expand Up @@ -77,6 +79,7 @@
"ajv-formats": "^3.0.1",
"ajv-sanitizer": "^1.2.1",
"bcrypt": "^5.1.1",
"compression": "^1.7.4",
"connect-flash": "^0.1.1",
"connect-redis": "^7.1.1",
"cookie-parser": "^1.4.6",
Expand All @@ -94,6 +97,7 @@
"google-auth-library": "^9.6.3",
"googleapis": "^39.2.0",
"googleapis-common": "^7.0.1",
"helmet": "^7.1.0",
"http": "^0.0.1-security",
"https": "^1.0.0",
"jsonwebtoken": "^9.0.2",
Expand Down
6 changes: 6 additions & 0 deletions src/routes/configRoutes.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,25 @@
import path from 'path';
import bodyParser from 'body-parser';
import helmet from 'helmet';
import favicon from 'serve-favicon';
import express from 'express';
import cookieParser from 'cookie-parser';
import flash from 'connect-flash';
import { doubleCsrfProtection, setCsrfToken } from '../config/csrf';
import session from '../config/session';
import { fileRoot } from '../utils/utils';
import compression from 'compression';

const configRouter = express.Router();

configRouter.use(express.json());

configRouter.use(bodyParser.urlencoded({ extended: false }));

configRouter.use(helmet());

configRouter.use(compression());

configRouter.use(favicon(path.join(fileRoot, 'public', 'favicon.ico')));

configRouter.use(express.static(path.join(fileRoot, '/public')));
Expand Down

0 comments on commit 076f046

Please sign in to comment.