Skip to content

Commit a2d335a

Browse files
committed
Added Compression package
1 parent c0fc2ad commit a2d335a

File tree

3 files changed

+111
-1
lines changed

3 files changed

+111
-1
lines changed

app.js

+4
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ const path = require('path');
44
const express = require('express');
55
const nunjucks = require('nunjucks');
66
const cors = require('cors');
7+
const compression = require('compression');
78
// Our modules
89
const AppError = require('./utils/appError');
910
const globalErrorHandler = require('./controllers/errorController');
@@ -29,6 +30,9 @@ app.set('view engine', 'njk');
2930
// Serve static files
3031
app.use(express.static(path.join(__dirname, 'public')));
3132

33+
// Compress res data
34+
app.use(compression());
35+
3236
app.use('/', viewRoutes);
3337
// Product routes
3438
app.use('/api/v1/products', productRoutes);

package-lock.json

+106-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
"author": "Shanmugam M",
1515
"license": "ISC",
1616
"dependencies": {
17+
"compression": "^1.7.4",
1718
"cors": "^2.8.5",
1819
"dotenv": "^10.0.0",
1920
"express": "^4.17.1",

0 commit comments

Comments
 (0)