Server by id (api)

This commit is contained in:
2025-10-13 23:23:20 +02:00
parent 583a6e021a
commit a5edc7677c
+27
View File
@@ -0,0 +1,27 @@
import { NextRequest, NextResponse } from "next/server";
import { supabase } from "../../supa";
import { StatusCodes } from "http-status-codes";
/**
* GET /api/server/<id>
*/
export async function GET(
req: NextRequest,
{ params }: { params: Promise<{ id: string }> }
) {
const { id } = await params;
const { data: profile } = await supabase
.from("servers")
.select("id, created_at, owner, address")
.eq("id", id)
.maybeSingle();
if (!profile)
return NextResponse.json(
{ message: "not found" },
{ status: StatusCodes.NOT_FOUND }
);
return NextResponse.json({ message: "ok", ...profile });
}