Skip to content

Commit

Permalink
✨ Add status endpoint (#1546)
Browse files Browse the repository at this point in the history
  • Loading branch information
lukevella authored Feb 5, 2025
1 parent c505d74 commit d7cb362
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions apps/web/src/app/api/status/route.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { prisma } from "@rallly/database";
import { NextResponse } from "next/server";

async function getDatabaseStatus() {
try {
await prisma.$connect();
return "connected";
} catch (e) {
return "disconnected";
}
}

export const GET = async () => {
const database = await getDatabaseStatus();
const version = process.env.NEXT_PUBLIC_APP_VERSION || "unknown";
const environment = process.env.NODE_ENV;
const timestamp = new Date().toISOString();

const status = {
status: "ok",
timestamp,
version,
environment,
database,
};

return NextResponse.json(status);
};

0 comments on commit d7cb362

Please sign in to comment.