summary refs log tree commit diff
path: root/src/api/routes/-/readyz.ts
blob: 5dee9e86e64de59c4df3717b5ed28934ec668c26 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import { route } from "@fosscord/api";
import { Request, Response, Router } from "express";
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;