Skip to content

Commit

Permalink
Use expressStaticGzip to serve instead (#80)
Browse files Browse the repository at this point in the history
Use expressStaticGzip to serve instead
  • Loading branch information
dungwinux authored Apr 21, 2019
2 parents d6dfca0 + 3d16614 commit 1a968ec
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
8 changes: 3 additions & 5 deletions src/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down Expand Up @@ -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(
Expand Down

0 comments on commit 1a968ec

Please sign in to comment.