@misterzik/espressojs 3.2.3 → 3.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +5 -10
- package/package.json +2 -2
- package/routes/utils/index.js +1 -1
- package/server/utils/config.utils.js +12 -1
package/index.js
CHANGED
|
@@ -13,7 +13,10 @@ require("dotenv").config();
|
|
|
13
13
|
const express = require("express");
|
|
14
14
|
const app = express();
|
|
15
15
|
const cfg = require("./server");
|
|
16
|
-
const {
|
|
16
|
+
const {
|
|
17
|
+
readConfigFile,
|
|
18
|
+
setCustomCacheControl,
|
|
19
|
+
} = require("./server/utils/config.utils");
|
|
17
20
|
const configData = readConfigFile();
|
|
18
21
|
|
|
19
22
|
const Path = require("path");
|
|
@@ -40,8 +43,7 @@ if (configData.mongo_isEnabled) {
|
|
|
40
43
|
":" +
|
|
41
44
|
process.env.MONGO_TOKEN +
|
|
42
45
|
"@" +
|
|
43
|
-
mongoUri
|
|
44
|
-
+
|
|
46
|
+
mongoUri +
|
|
45
47
|
hasPort +
|
|
46
48
|
mongoDb
|
|
47
49
|
}`;
|
|
@@ -57,12 +59,6 @@ if (configData.mongo_isEnabled) {
|
|
|
57
59
|
.catch((err) => console.error(err));
|
|
58
60
|
}
|
|
59
61
|
|
|
60
|
-
const setCustomCacheControl = (res, path) => {
|
|
61
|
-
if (Static.mime.lookup(path) === "text/html") {
|
|
62
|
-
res.setHeader("Cache-Control", "public, max-age=0");
|
|
63
|
-
}
|
|
64
|
-
};
|
|
65
|
-
|
|
66
62
|
app.use(Compression());
|
|
67
63
|
app.use(Cors());
|
|
68
64
|
app.use(express.urlencoded({ extended: false }));
|
|
@@ -76,7 +72,6 @@ app.use(
|
|
|
76
72
|
extensions: "error.html",
|
|
77
73
|
})
|
|
78
74
|
);
|
|
79
|
-
|
|
80
75
|
Routes(app);
|
|
81
76
|
app.listen(Port, () => {
|
|
82
77
|
console.log(`Server is running on port ${Port}`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@misterzik/espressojs",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.5",
|
|
4
4
|
"description": "EspressoJS Introducing Espresso.JS, your ultimate Express configuration starting point and boilerplate. With its simplicity and lack of opinionation, EspressoJS offers plug-and-play configurations built on top of Express.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"bluebird": "^3.7.2",
|
|
41
41
|
"cross-env": "^7.0.3",
|
|
42
42
|
"express": "^4.18.2",
|
|
43
|
-
"mongoose": "^7.3.
|
|
43
|
+
"mongoose": "^7.3.1",
|
|
44
44
|
"dotenv": "^16.3.1",
|
|
45
45
|
"cors": "^2.8.5",
|
|
46
46
|
"finalhandler": "^1.2.0",
|
package/routes/utils/index.js
CHANGED
|
@@ -20,4 +20,15 @@ const vmdLogo = `
|
|
|
20
20
|
'----'/.ZI|<..
|
|
21
21
|
`;
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
const setCustomCacheControl = (res, path) => {
|
|
24
|
+
if (Static.mime.lookup(path) === "text/html") {
|
|
25
|
+
res.setHeader("Cache-Control", "public, max-age=0");
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
module.exports = {
|
|
30
|
+
readConfigFile,
|
|
31
|
+
writeConfigFile,
|
|
32
|
+
vmdLogo,
|
|
33
|
+
setCustomCacheControl,
|
|
34
|
+
};
|