bun-platform-kit 1.0.0 → 1.1.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.
|
@@ -27,7 +27,10 @@ function BunKitStandardServer(port, arg2, arg3, arg4) {
|
|
|
27
27
|
processOptionalArg(arg3);
|
|
28
28
|
processOptionalArg(arg4);
|
|
29
29
|
addServices(options?.services);
|
|
30
|
-
const modulesToRegister = [
|
|
30
|
+
const modulesToRegister = [
|
|
31
|
+
controllersModule,
|
|
32
|
+
new modules_1.HealthModule(),
|
|
33
|
+
];
|
|
31
34
|
const preset = options?.modules;
|
|
32
35
|
const registerModule = (factory, override) => {
|
|
33
36
|
if (override === false) {
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.HealthModule = void 0;
|
|
4
|
+
const abstract_1 = require("../abstract");
|
|
5
|
+
const adapters_1 = require("../adapters");
|
|
6
|
+
const node_os_1 = require("node:os");
|
|
7
|
+
class HealthModule extends abstract_1.BaseServerModule {
|
|
8
|
+
constructor() {
|
|
9
|
+
super(...arguments);
|
|
10
|
+
this.name = "Health";
|
|
11
|
+
this.priority = 10;
|
|
12
|
+
}
|
|
13
|
+
getModuleName() {
|
|
14
|
+
return this.name;
|
|
15
|
+
}
|
|
16
|
+
init(app, context) {
|
|
17
|
+
const adapter = context?.adapter ?? new adapters_1.BunAdapter();
|
|
18
|
+
const router = adapter.createRouter();
|
|
19
|
+
router.get("/health", (_req, res) => {
|
|
20
|
+
res.json({
|
|
21
|
+
status: "ok",
|
|
22
|
+
hostname: (0, node_os_1.hostname)(),
|
|
23
|
+
timestamp: new Date().toISOString(),
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
app.use("/", router);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
exports.HealthModule = HealthModule;
|
package/dist/modules/index.d.ts
CHANGED
package/dist/modules/index.js
CHANGED
|
@@ -17,6 +17,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
__exportStar(require("./CorsModule"), exports);
|
|
18
18
|
__exportStar(require("./ControllersModule"), exports);
|
|
19
19
|
__exportStar(require("./FileUploadModule"), exports);
|
|
20
|
+
__exportStar(require("./HealthModule"), exports);
|
|
20
21
|
__exportStar(require("./RateLimitModule"), exports);
|
|
21
22
|
__exportStar(require("./RequestContextModule"), exports);
|
|
22
23
|
__exportStar(require("./SecurityModule"), exports);
|