mirror of
https://github.com/kingomarnajjar/flex-template-web.git
synced 2026-07-29 05:00:43 +10:00
Add gzip compression middleware to the express server
This commit is contained in:
parent
4b0f0bb9c2
commit
f97c1f1498
3 changed files with 4 additions and 1 deletions
|
|
@ -6,6 +6,7 @@
|
|||
"sharetribe-scripts": "0.8.4"
|
||||
},
|
||||
"dependencies": {
|
||||
"compression": "^1.6.2",
|
||||
"express": "^4.14.0",
|
||||
"helmet": "^3.3.0",
|
||||
"lodash": "^4.17.4",
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ require('source-map-support').install();
|
|||
|
||||
const express = require('express');
|
||||
const helmet = require('helmet');
|
||||
const compression = require('compression');
|
||||
const path = require('path');
|
||||
const fs = require('fs');
|
||||
const _ = require('lodash');
|
||||
|
|
@ -82,6 +83,7 @@ const app = express();
|
|||
// See: https://www.npmjs.com/package/helmet
|
||||
app.use(helmet());
|
||||
|
||||
app.use(compression());
|
||||
app.use('/static', express.static(path.join(buildPath, 'static')));
|
||||
|
||||
app.get('*', (req, res) => {
|
||||
|
|
|
|||
|
|
@ -1307,7 +1307,7 @@ compressible@~2.0.8:
|
|||
dependencies:
|
||||
mime-db ">= 1.24.0 < 2"
|
||||
|
||||
compression@^1.5.2:
|
||||
compression@^1.5.2, compression@^1.6.2:
|
||||
version "1.6.2"
|
||||
resolved "https://registry.yarnpkg.com/compression/-/compression-1.6.2.tgz#cceb121ecc9d09c52d7ad0c3350ea93ddd402bc3"
|
||||
dependencies:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue