mirror of
https://github.com/lukevella/rallly.git
synced 2025-04-28 17:56:37 +02:00
✨ Add status endpoint (#1546)
This commit is contained in:
parent
c505d7441d
commit
d7cb362c0b
1 changed files with 28 additions and 0 deletions
28
apps/web/src/app/api/status/route.ts
Normal file
28
apps/web/src/app/api/status/route.ts
Normal file
|
@ -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);
|
||||||
|
};
|
Loading…
Add table
Reference in a new issue