Skip to content

Papermark is the open-source DocSend alternative and secure data rooms with built-in analytics and custom domains.

feat: add health endpoint

Marc Seitzb3ddf8c73521
diff --git a/pages/api/health.ts b/pages/api/health.ts
new file mode 100644
index 00000000..51faa1d0
--- /dev/null
+++ b/pages/api/health.ts
@@ -0,0 +1,23 @@
+import type { NextApiRequest, NextApiResponse } from "next";
+import prisma from "@/lib/prisma";
+
+export default async function handler(
+ _req: NextApiRequest,
+ res: NextApiResponse,
+) {
+ try {
+ await prisma.$queryRaw`SELECT 1`;
+
+ return res.json({
+ status: "ok",
+ message: "All systems operational",
+ });
+ } catch (err) {
+ console.error(err);
+
+ return res.status(500).json({
+ status: "error",
+ message: (err as Error).message,
+ });
+ }
+}