diff --git a/package.json b/package.json index d7e7026a..f088c85d 100644 --- a/package.json +++ b/package.json @@ -41,6 +41,7 @@ "express-brute": "^1.0.1", "express-brute-nedb": "^1.1.0", "express-session": "^1.15.6", + "express-static-gzip": "^1.1.3", "form-data": "^2.3.3", "helmet": "^3.15.0", "ip": "^1.1.5", diff --git a/src/server.js b/src/server.js index be2030e8..6686a0ec 100644 --- a/src/server.js +++ b/src/server.js @@ -7,6 +7,7 @@ const passport = require("passport"); const session = require("express-session"); const bodyParser = require("body-parser"); const ip = require("ip"); +const expressStaticGzip = require("express-static-gzip"); const server = require("./config/server"); const passportConfig = require("./controller/passportConfig"); @@ -63,11 +64,8 @@ app.all("/api/*", (req, res) => { res.sendStatus(404); }); -app.use("/", express.static(server.staticFolder)); -// Temp solution ? -app.use("/*", (req, res) => { - res.sendFile(server.staticFolder + "/index.html"); -}); +app.use("/", expressStaticGzip(server.staticFolder)); +app.use("/*", expressStaticGzip(server.staticFolder)); let serv = app.listen(PORT, () => { Console.log(