Files
buzz/app/cdn/[id]/route.ts
T
dmgnr 4559f4693c
Build and Push Image / build-backend (push) Successful in 2m13s
Build and Push Image / build-frontend (push) Successful in 4m9s
Build and Push Image / push (push) Successful in 4m21s
refactor(host): migrate from docker swarm to kubernetes
2026-06-19 18:18:17 +00:00

23 lines
640 B
TypeScript
Executable File

import { eq } from "drizzle-orm";
import { notFound } from "next/navigation";
import { db } from "@/lib/db";
import { cdn } from "@/lib/db/schema";
export const dynamic = "force-dynamic";
export async function GET(
_req: Request,
{ params }: { params: Promise<{ id: string }> },
) {
const { id } = await params;
const [file] = await db.select().from(cdn).where(eq(cdn.id, id)).limit(1);
if (!file) return notFound();
return new Response(new Uint8Array(file.data), {
headers: {
"Content-Type": file.type,
"Content-Length": file.size,
"Cache-Control": "public, max-age=31536000, immutable",
},
});
}