Initial commit: website

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Alireza Hassani
2026-10-03 23:17:38 +03:30
co-authored by Cursor
commit dc93a202bf
160 changed files with 16454 additions and 0 deletions
+49
View File
@@ -0,0 +1,49 @@
import { NextRequest, NextResponse } from "next/server";
const MESHKEE_API_URL =
process.env.MESHKEE_API_URL?.replace(/\/$/, "") ||
process.env.NEXT_PUBLIC_MESHKEE_API_URL?.replace(/\/$/, "") ||
"https://api.meshkee.com/api/v1";
function authHeader(request: NextRequest): string | null {
const incoming = request.headers.get("authorization")?.trim();
if (incoming) return incoming;
const token = process.env.MESHKEE_API_TOKEN?.trim();
return token ? `Bearer ${token}` : null;
}
export async function GET(request: NextRequest) {
const auth = authHeader(request);
if (!auth) {
return NextResponse.json(
{
message:
"Meshkee categories need auth. Set MESHKEE_API_TOKEN or sign in on the dashboard first.",
},
{ status: 503 },
);
}
const q = request.nextUrl.searchParams.get("q")?.trim() ?? "";
const params = new URLSearchParams();
if (q) params.set("q", q);
const response = await fetch(
`${MESHKEE_API_URL}/business-categories?${params}`,
{
headers: { Authorization: auth },
cache: "no-store",
},
);
const payload = await response.json().catch(() => null);
if (!response.ok) {
return NextResponse.json(
payload ?? { message: `Meshkee error (${response.status})` },
{ status: response.status },
);
}
return NextResponse.json(payload);
}