summary refs log tree commit diff
path: root/api/src/routes/-/readyz.ts
diff options
context:
space:
mode:
authorFlam3rboy <34555296+Flam3rboy@users.noreply.github.com>2021-10-15 13:32:26 +0200
committerFlam3rboy <34555296+Flam3rboy@users.noreply.github.com>2021-10-15 13:32:26 +0200
commite1b991dfd14278b0c60163d92e4db0f18269b112 (patch)
treec9ed9bc8c7b00ded9207c9fcc9365e86d57fc146 /api/src/routes/-/readyz.ts
parent:art: reformat (diff)
parent:bug: fix unittests (diff)
downloadserver-e1b991dfd14278b0c60163d92e4db0f18269b112.tar.xz
Merge branch 'master' into sticker
Diffstat (limited to 'api/src/routes/-/readyz.ts')
-rw-r--r--api/src/routes/-/readyz.ts17
1 files changed, 17 insertions, 0 deletions
diff --git a/api/src/routes/-/readyz.ts b/api/src/routes/-/readyz.ts
new file mode 100644

index 00000000..a42575f8 --- /dev/null +++ b/api/src/routes/-/readyz.ts
@@ -0,0 +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) => { + try { + // test that the database is alive & responding + getConnection(); + return res.sendStatus(200); + } catch(e) { + res.sendStatus(503); + } +}); + +export default router;