1
0
mirror of https://github.com/spacebarchat/server.git synced 2024-11-11 05:02:37 +01:00

feat: implement a database check on the healthz and readyz probes, remove /-/metrics

This commit is contained in:
Hayden Young 2021-10-14 18:47:05 +01:00
parent d5057ab888
commit 35ef010ba9
3 changed files with 16 additions and 12 deletions

View File

@ -1,10 +1,17 @@
import { Router, Response, Request } from "express";
import { route } from "@fosscord/api";
import { getConnection } from "typeorm";
const router = Router();
router.get("/", route({}), (req: Request, res: Response) => {
res.sendStatus(200);
try {
// test that the database is alive & responding
getConnection();
return res.sendStatus(200);
} catch(e) {
res.sendStatus(503);
}
});
export default router;

View File

@ -1,10 +0,0 @@
import { Router, Response, Request } from "express";
import { route } from "@fosscord/api";
const router = Router();
router.get("/", route({}), (req: Request, res: Response) => {
res.sendStatus(200);
});
export default router;

View File

@ -1,10 +1,17 @@
import { Router, Response, Request } from "express";
import { route } from "@fosscord/api";
import { getConnection } from "typeorm";
const router = Router();
router.get("/", route({}), (req: Request, res: Response) => {
res.sendStatus(200);
try {
// test that the database is alive & responding
getConnection();
return res.sendStatus(200);
} catch(e) {
res.sendStatus(503);
}
});
export default router;