zyket 1.0.14 → 1.0.15
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
|
@@ -34,14 +34,13 @@ module.exports = class Express extends Service {
|
|
|
34
34
|
const routes = await this.#loadRoutesFromFolder(path.join(process.cwd(), "src", "routes"));
|
|
35
35
|
|
|
36
36
|
routes.forEach((route) => {
|
|
37
|
-
const
|
|
38
|
-
for (const
|
|
37
|
+
const methods = ['post', 'get', 'put', 'delete']
|
|
38
|
+
for (const methodName of methods) {
|
|
39
|
+
const method = route[methodName];
|
|
39
40
|
if(!method) continue;
|
|
40
|
-
const methodName = method === post ? 'post' : 'get';
|
|
41
41
|
this.#container.get('logger').debug(`Registering route: [${methodName}] ${route.path}`);
|
|
42
42
|
const middlewares = route?.middlewares?.[methodName] || [];
|
|
43
43
|
for (const mw of middlewares) {
|
|
44
|
-
// mw is instance of Middleware
|
|
45
44
|
if (!(mw instanceof Middleware)) {
|
|
46
45
|
throw new Error(`Middleware for route ${route.path} is not an instance of Middleware`);
|
|
47
46
|
}
|