Use gzip compression
This commit is contained in:
parent
576852e919
commit
6cf153c36b
@ -17,6 +17,7 @@
|
||||
"build_and_publish": "yarn test && yarn build && cd dist && yarn publish"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/compression": "^1.7.0",
|
||||
"@types/config": "^0.0.36",
|
||||
"@types/connect-flash": "^0.0.35",
|
||||
"@types/connect-redis": "^0.0.13",
|
||||
@ -44,6 +45,7 @@
|
||||
"@types/redis": "^2.8.18",
|
||||
"@types/ws": "^7.2.4",
|
||||
"argon2": "^0.26.2",
|
||||
"compression": "^1.7.4",
|
||||
"config": "^3.3.1",
|
||||
"connect-flash": "^0.1.1",
|
||||
"connect-redis": "^4.0.4",
|
||||
|
@ -4,6 +4,7 @@ import Logger from "../Logger";
|
||||
import {Server} from "http";
|
||||
import {IncomingForm} from "formidable";
|
||||
import {FileError, ValidationBag} from "../db/Validator";
|
||||
import compression from "compression";
|
||||
|
||||
export default class ExpressAppComponent extends ApplicationComponent<void> {
|
||||
private readonly port: number;
|
||||
@ -24,6 +25,9 @@ export default class ExpressAppComponent extends ApplicationComponent<void> {
|
||||
extended: true,
|
||||
}));
|
||||
|
||||
// gzip
|
||||
router.use(compression());
|
||||
|
||||
router.use((req, res, next) => {
|
||||
req.models = {};
|
||||
req.modelCollections = {};
|
||||
|
36
yarn.lock
36
yarn.lock
@ -531,6 +531,13 @@
|
||||
resolved "https://registry.toot.party/@types%2fcolor-name/-/color-name-1.1.1.tgz#1c1261bbeaa10a8055bbc5d8ab84b7b2afc846a0"
|
||||
integrity sha512-rr+OQyAjxze7GgWrSaJwydHStIhHq2lvY3BOC2Mj7KnzI7XK0Uw1TOOdI9lDoajEbSWLiYgoo4f1R51erQfhPQ==
|
||||
|
||||
"@types/compression@^1.7.0":
|
||||
version "1.7.0"
|
||||
resolved "https://registry.toot.party/@types%2fcompression/-/compression-1.7.0.tgz#8dc2a56604873cf0dd4e746d9ae4d31ae77b2390"
|
||||
integrity sha512-3LzWUM+3k3XdWOUk/RO+uSjv7YWOatYq2QADJntK1pjkk4DfVP0KrIEPDnXRJxAAGKe0VpIPRmlINLDuCedZWw==
|
||||
dependencies:
|
||||
"@types/express" "*"
|
||||
|
||||
"@types/config@^0.0.36":
|
||||
version "0.0.36"
|
||||
resolved "https://registry.toot.party/@types%2fconfig/-/config-0.0.36.tgz#bf53ca640f3a1a6a2072a9f33e02a44def07a40b"
|
||||
@ -787,7 +794,7 @@ abbrev@1:
|
||||
resolved "https://registry.toot.party/abbrev/-/abbrev-1.1.1.tgz#f8f2c887ad10bf67f634f005b6987fed3179aac8"
|
||||
integrity sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==
|
||||
|
||||
accepts@~1.3.4, accepts@~1.3.7:
|
||||
accepts@~1.3.4, accepts@~1.3.5, accepts@~1.3.7:
|
||||
version "1.3.7"
|
||||
resolved "https://registry.toot.party/accepts/-/accepts-1.3.7.tgz#531bc726517a3b2b41f850021c6cc15eaab507cd"
|
||||
integrity sha512-Il80Qs2WjYlJIBNzNkK6KYqlVMTbZLXgHx2oT0pU/fjRHyEp+PEfEPY0R3WCwAGVOtauxh1hOxNgIf5bv7dQpA==
|
||||
@ -1251,6 +1258,11 @@ buffer-from@1.x, buffer-from@^1.0.0:
|
||||
resolved "https://registry.toot.party/buffer-from/-/buffer-from-1.1.1.tgz#32713bc028f75c02fdb710d7c7bcec1f2c6070ef"
|
||||
integrity sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==
|
||||
|
||||
bytes@3.0.0:
|
||||
version "3.0.0"
|
||||
resolved "https://registry.toot.party/bytes/-/bytes-3.0.0.tgz#d32815404d689699f85a4ea4fa8755dd13a96048"
|
||||
integrity sha1-0ygVQE1olpn4Wk6k+odV3ROpYEg=
|
||||
|
||||
bytes@3.1.0:
|
||||
version "3.1.0"
|
||||
resolved "https://registry.toot.party/bytes/-/bytes-3.1.0.tgz#f6cf7933a360e0588fa9fde85651cdc7f805d1f6"
|
||||
@ -1504,6 +1516,26 @@ component-inherit@0.0.3:
|
||||
resolved "https://registry.toot.party/component-inherit/-/component-inherit-0.0.3.tgz#645fc4adf58b72b649d5cae65135619db26ff143"
|
||||
integrity sha1-ZF/ErfWLcrZJ1crmUTVhnbJv8UM=
|
||||
|
||||
compressible@~2.0.16:
|
||||
version "2.0.18"
|
||||
resolved "https://registry.toot.party/compressible/-/compressible-2.0.18.tgz#af53cca6b070d4c3c0750fbd77286a6d7cc46fba"
|
||||
integrity sha512-AF3r7P5dWxL8MxyITRMlORQNaOA2IkAFaTr4k7BUumjPtRpGDTZpl0Pb1XCO6JeDCBdp126Cgs9sMxqSjgYyRg==
|
||||
dependencies:
|
||||
mime-db ">= 1.43.0 < 2"
|
||||
|
||||
compression@^1.7.4:
|
||||
version "1.7.4"
|
||||
resolved "https://registry.toot.party/compression/-/compression-1.7.4.tgz#95523eff170ca57c29a0ca41e6fe131f41e5bb8f"
|
||||
integrity sha512-jaSIDzP9pZVS4ZfQ+TzvtiWhdpFhE2RDHz8QJkpX9SIpLq88VueF5jJw6t+6CUQcAoA6t+x89MLrWAqpfDE8iQ==
|
||||
dependencies:
|
||||
accepts "~1.3.5"
|
||||
bytes "3.0.0"
|
||||
compressible "~2.0.16"
|
||||
debug "2.6.9"
|
||||
on-headers "~1.0.2"
|
||||
safe-buffer "5.1.2"
|
||||
vary "~1.1.2"
|
||||
|
||||
concat-map@0.0.1:
|
||||
version "0.0.1"
|
||||
resolved "https://registry.toot.party/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b"
|
||||
@ -3701,7 +3733,7 @@ micromatch@^3.1.4:
|
||||
snapdragon "^0.8.1"
|
||||
to-regex "^3.0.2"
|
||||
|
||||
mime-db@1.44.0:
|
||||
mime-db@1.44.0, "mime-db@>= 1.43.0 < 2":
|
||||
version "1.44.0"
|
||||
resolved "https://registry.toot.party/mime-db/-/mime-db-1.44.0.tgz#fa11c5eb0aca1334b4233cb4d52f10c5a6272f92"
|
||||
integrity sha512-/NOTfLrsPBVeH7YtFPgsVWveuL+4SjjYxaQ1xtM1KMFj7HdxlBlxeyNLzhyJVx7r4rZGJAZ/6lkKCitSc/Nmpg==
|
||||
|
Loading…
Reference in New Issue
Block a user