summary refs log tree commit diff
path: root/api/src/routes/-/healthz.ts
blob: f7bcfebf17da747ba6372dd8a382f91c6e99819a (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;