Skip to content

Commit d1e0d45

Browse files
yn5somus
authored andcommitted
Add and implement compression module in order to gzip all request to express (#154)
Add and implement compression module in order to gzip all request to express
1 parent 0b06f15 commit d1e0d45

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
"dependencies": {
3333
"babel-core": "^6.9.1",
3434
"body-parser": "^1.15.1",
35+
"compression": "^1.6.2",
3536
"cross-env": "^1.0.8",
3637
"cuid": "^1.3.8",
3738
"express": "^4.13.4",

server/server.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import Express from 'express';
2+
import compression from 'compression';
23
import mongoose from 'mongoose';
34
import bodyParser from 'body-parser';
45
import path from 'path';
@@ -46,6 +47,7 @@ mongoose.connect(serverConfig.mongoURL, (error) => {
4647
});
4748

4849
// Apply body Parser and server public assets and routes
50+
app.use(compression());
4951
app.use(bodyParser.json({ limit: '20mb' }));
5052
app.use(bodyParser.urlencoded({ limit: '20mb', extended: false }));
5153
app.use(Express.static(path.resolve(__dirname, '../dist')));

0 commit comments

Comments
 (0)