Implement json request compression

This commit is contained in:
David Majdandžić
2023-04-01 16:49:50 +02:00
parent 61de0b2a2c
commit af199c9449
4 changed files with 24 additions and 5 deletions

View File

@@ -6,6 +6,8 @@ import {RequestHandler} from "./RequestHandler";
const express = require("express");
const bodyParser = require("body-parser");
const compression = require("compression");
const zlib = require("zlib");
const SERVER_PORT: number = Number(process.env.SERVER_PORT) || 8190;
@@ -24,6 +26,11 @@ export class HttpServer {
this.app = express();
this.app.use(bodyParser.json());
this.app.use(compression({
level: 9,
strategy: zlib.constants.BROTLI_MODE_TEXT,
}));
let clientApiPath: string = 'ClientEntity';
let centerApiPath: string = 'CenterEntity';