zyket 1.0.29 → 1.0.30
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/package.json
CHANGED
|
@@ -50,7 +50,6 @@ module.exports = class Express extends Service {
|
|
|
50
50
|
...Express.swaggerConfig,
|
|
51
51
|
apis: [path.join(process.cwd(), "src", "routes", "**", "*.js")],
|
|
52
52
|
};
|
|
53
|
-
console.log("Swagger Options:", swaggerOptions);
|
|
54
53
|
const swaggerDocs = swaggerJsDoc(swaggerOptions);
|
|
55
54
|
this.#app.use("/docs", swaggerUi.serve, swaggerUi.setup(swaggerDocs));
|
|
56
55
|
|
|
@@ -71,7 +70,14 @@ module.exports = class Express extends Service {
|
|
|
71
70
|
|
|
72
71
|
this.#app[methodName](
|
|
73
72
|
route.path,
|
|
74
|
-
...middlewares.map(mw => (req, res, next) =>
|
|
73
|
+
...middlewares.map(mw => async (req, res, next) => {
|
|
74
|
+
try {
|
|
75
|
+
await mw.handle({ container: this.#container, request: req, response: res, next })
|
|
76
|
+
} catch (error) {
|
|
77
|
+
this.#container.get('logger').error(`Error in middleware for route [${methodName}] ${route.path}: ${error.message}`);
|
|
78
|
+
return res.status(500).json({ success: false, message: error.message || 'Internal Server Error' });
|
|
79
|
+
}
|
|
80
|
+
}),
|
|
75
81
|
async (req, res) => {
|
|
76
82
|
try {
|
|
77
83
|
const routeResponse = await route[methodName]({ container: this.#container, request: req, response: res });
|