summary refs log tree commit diff
path: root/api/src/routes/-/readyz.ts
diff options
context:
space:
mode:
authorHayden Young <hi@hbjy.dev>2021-10-15 10:33:02 +0000
committerGitHub <noreply@github.com>2021-10-15 10:33:02 +0000
commit4d04e6fcc5142ed197ead89eceb01b2da2bed6dd (patch)
tree5ba4c9b6e839faae5cdfab16005aaa95ab19c3fa /api/src/routes/-/readyz.ts
parentchore: update ts-node during npm run setup (diff)
parentMerge pull request #460 from fosscord/dev (diff)
downloadserver-4d04e6fcc5142ed197ead89eceb01b2da2bed6dd.tar.xz
Merge branch 'master' into cdn-s3
Diffstat (limited to '')
-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;