Files
rednote-tool-studio/app/api/image-projects/[id]/images/[file]/route.ts
T
hexin-codex-bot 276a8ae473
Verify and deploy production / verify-and-deploy (push) Successful in 2m34s
feat: add image project dashboard and canvas editor
2026-10-05 15:20:43 +08:00

15 lines
636 B
TypeScript

import { NextResponse } from "next/server";
import { readImageProjectFile } from "../../../../../../lib/image-projects";
import { errorResponse } from "../../../../../../lib/http";
export const runtime = "nodejs";
type Context = { params: Promise<{ id: string; file: string }> };
export async function GET(_: Request, context: Context) {
try {
const { id, file } = await context.params;
const image = await readImageProjectFile(id, file);
return new NextResponse(image.data, { headers: { "Content-Type": image.mimeType, "Cache-Control": "private, max-age=3600" } });
} catch (error) { return errorResponse(error); }
}