This commit is contained in:
19
apps/hub/app/api/config/route.ts
Normal file
19
apps/hub/app/api/config/route.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
import { prisma } from "@repo/db";
|
||||
import { NextResponse } from "next/server";
|
||||
|
||||
export async function GET(request: Request): Promise<NextResponse> {
|
||||
try {
|
||||
const config = await prisma.config.findFirst({
|
||||
orderBy: {
|
||||
createdAt: "desc",
|
||||
},
|
||||
});
|
||||
|
||||
return NextResponse.json(config, {
|
||||
status: 200,
|
||||
});
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
return NextResponse.json({ error: "Failed to fetch Aircrafts" }, { status: 500 });
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user