summary refs log tree commit diff
path: root/api/src/routes/-/healthz.ts
blob: a42575f8c6a236651fb1ec9be066a10f6168d3e7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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;