Files
sign/apps/web/pages/api/health.ts

16 lines
635 B
TypeScript
Raw Normal View History

2022-11-15 00:14:15 +01:00
import type { NextApiRequest, NextApiResponse } from "next";
2023-01-09 17:10:36 +01:00
import { defaultHandler, defaultResponder } from "@documenso/lib/server";
import prisma from "@documenso/prisma";
// Return a healthy 200 status code for uptime monitoring and render.com zero-downtime-deploy
async function getHandler(req: NextApiRequest, res: NextApiResponse) {
2023-03-02 18:42:38 +01:00
// Some generic database access to make sure the service is healthy.
2023-01-09 17:10:36 +01:00
const users = await prisma.user.findFirst();
2023-03-02 18:42:38 +01:00
return res.status(200).json({ message: "Api up and running :)" });
2022-11-15 00:14:15 +01:00
}
2023-01-09 17:10:36 +01:00
export default defaultHandler({
GET: Promise.resolve({ default: defaultResponder(getHandler) }),
});