Skip to content

Commit

Permalink
add health check endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
cstrnt committed Dec 10, 2023
1 parent 3d0ca3f commit 3477a8e
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions apps/web/src/pages/api/health.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { NextApiRequest, NextApiResponse } from "next";
import { prisma } from "server/db/client";
import { redis } from "server/db/redis";

export default async function handler(
req: NextApiRequest,
res: NextApiResponse
) {
// just a rndom query to check if db and redis are connected
await Promise.allSettled([
await prisma.verificationToken.count(),
await redis.get("test"),
]);
res.status(200).json({ status: "ok" });
}

2 comments on commit 3477a8e

@vercel
Copy link

@vercel vercel bot commented on 3477a8e Dec 10, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vercel
Copy link

@vercel vercel bot commented on 3477a8e Dec 10, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.