@beautinique/be-middlewares 1.0.0
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/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createDbConnectionMiddleware = void 0;
|
|
4
|
+
const be_classes_1 = require("@beautinique/be-classes");
|
|
5
|
+
const createDbConnectionMiddleware = (isDbReady) => {
|
|
6
|
+
return (_, __, next) => {
|
|
7
|
+
try {
|
|
8
|
+
if (isDbReady()) {
|
|
9
|
+
console.log("✅ DB connection is ready");
|
|
10
|
+
}
|
|
11
|
+
else {
|
|
12
|
+
throw new be_classes_1.AppError({
|
|
13
|
+
message: "Database not ready",
|
|
14
|
+
statusCode: 500,
|
|
15
|
+
code: "INTERNAL_ERROR",
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
next();
|
|
19
|
+
}
|
|
20
|
+
catch (error) {
|
|
21
|
+
next(error);
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
exports.createDbConnectionMiddleware = createDbConnectionMiddleware;
|
|
26
|
+
//# sourceMappingURL=database.middleware.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"database.middleware.js","sourceRoot":"","sources":["../../src/middlewares/database.middleware.ts"],"names":[],"mappings":";;;AACA,wDAAmD;AAI5C,MAAM,4BAA4B,GAAG,CAC1C,SAA8B,EAC9B,EAAE;IACF,OAAO,CAAC,CAAU,EAAE,EAAY,EAAE,IAAkB,EAAE,EAAE;QACtD,IAAI,CAAC;YACH,IAAI,SAAS,EAAE,EAAE,CAAC;gBAChB,OAAO,CAAC,GAAG,CAAC,0BAA0B,CAAC,CAAC;YAC1C,CAAC;iBAAM,CAAC;gBACN,MAAM,IAAI,qBAAQ,CAAC;oBACjB,OAAO,EAAE,oBAAoB;oBAC7B,UAAU,EAAE,GAAG;oBACf,IAAI,EAAE,gBAAgB;iBACvB,CAAC,CAAC;YACL,CAAC;YAED,IAAI,EAAE,CAAC;QACT,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,CAAC,KAAK,CAAC,CAAC;QACd,CAAC;IACH,CAAC,CAAC;AACJ,CAAC,CAAC;AApBW,QAAA,4BAA4B,gCAoBvC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@beautinique/be-middlewares",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Middlewares for the Beautinique backend project.",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": "./dist/index.js"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"dist"
|
|
12
|
+
],
|
|
13
|
+
"scripts": {
|
|
14
|
+
"build": "tsc",
|
|
15
|
+
"dev": "nodemon --exec node -r ts-node/register src/index.ts",
|
|
16
|
+
"start": "node dist/index.js",
|
|
17
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
18
|
+
},
|
|
19
|
+
"keywords": [],
|
|
20
|
+
"author": "Nageshwar",
|
|
21
|
+
"license": "ISC",
|
|
22
|
+
"type": "commonjs",
|
|
23
|
+
"devDependencies": {
|
|
24
|
+
"@types/express": "^5.0.6",
|
|
25
|
+
"typescript": "^6.0.2"
|
|
26
|
+
},
|
|
27
|
+
"dependencies": {
|
|
28
|
+
"@beautinique/be-classes": "^1.0.0",
|
|
29
|
+
"express": "^5.2.1"
|
|
30
|
+
}
|
|
31
|
+
}
|