@misterzik/espressojs 3.3.1 → 3.3.2
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 +8 -1
- package/package.json +1 -1
- package/routes/index.js +5 -4
- package/.env +0 -3
package/index.js
CHANGED
|
@@ -102,7 +102,14 @@ app.get("/health", healthCheck);
|
|
|
102
102
|
app.get("/ready", readinessCheck);
|
|
103
103
|
app.get("/alive", livenessCheck);
|
|
104
104
|
|
|
105
|
-
|
|
105
|
+
const fs = require("fs");
|
|
106
|
+
const faviconPath = Path.join(rootDir, publicDir, "favicon.ico");
|
|
107
|
+
if (fs.existsSync(faviconPath)) {
|
|
108
|
+
app.use(Favicon(faviconPath));
|
|
109
|
+
} else {
|
|
110
|
+
logger.warn(`Favicon not found at ${faviconPath}, skipping...`);
|
|
111
|
+
}
|
|
112
|
+
|
|
106
113
|
app.use(
|
|
107
114
|
Static(Path.join(rootDir, publicDir), {
|
|
108
115
|
maxAge: "1d",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@misterzik/espressojs",
|
|
3
|
-
"version": "3.3.
|
|
3
|
+
"version": "3.3.2",
|
|
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": {
|
package/routes/index.js
CHANGED
|
@@ -11,10 +11,11 @@
|
|
|
11
11
|
|
|
12
12
|
const path = require("path");
|
|
13
13
|
const fs = require("fs");
|
|
14
|
-
const
|
|
14
|
+
const { readConfigFile } = require("../server/utils/config.utils");
|
|
15
15
|
const logger = require("../server/utils/logger");
|
|
16
16
|
const { asyncHandler } = require("../server/middleware/errorHandler");
|
|
17
17
|
const rootDir = process.cwd();
|
|
18
|
+
const configuration = readConfigFile();
|
|
18
19
|
|
|
19
20
|
module.exports = (app) => {
|
|
20
21
|
app.get(
|
|
@@ -26,7 +27,7 @@ module.exports = (app) => {
|
|
|
26
27
|
logger.warn("index.html not found, sending default response");
|
|
27
28
|
return res.status(200).json({
|
|
28
29
|
message: "Welcome to EspressoJS",
|
|
29
|
-
version: "3.2
|
|
30
|
+
version: "3.3.2",
|
|
30
31
|
documentation: "https://github.com/misterzik/Espresso.js",
|
|
31
32
|
});
|
|
32
33
|
}
|
|
@@ -35,7 +36,7 @@ module.exports = (app) => {
|
|
|
35
36
|
})
|
|
36
37
|
);
|
|
37
38
|
|
|
38
|
-
if (configuration.
|
|
39
|
+
if (configuration.api && configuration.api.enabled === true) {
|
|
39
40
|
try {
|
|
40
41
|
const apiRoutes = require(path.join(rootDir, "routes", "api.js"));
|
|
41
42
|
app.use("/api", apiRoutes);
|
|
@@ -45,7 +46,7 @@ module.exports = (app) => {
|
|
|
45
46
|
}
|
|
46
47
|
}
|
|
47
48
|
|
|
48
|
-
if (configuration.
|
|
49
|
+
if (configuration.mongoDB && configuration.mongoDB.enabled === true) {
|
|
49
50
|
try {
|
|
50
51
|
const dbRoutes = require(path.join(rootDir, "routes", "db.js"));
|
|
51
52
|
app.use("/api/db", dbRoutes);
|
package/.env
DELETED