feat: servir arquivos do MinIO via API interna

This commit is contained in:
Erik
2025-11-27 15:20:30 -03:00
parent 30ddb5392e
commit ca3eac5e1e
5 changed files with 69 additions and 23 deletions

View File

@@ -20,11 +20,9 @@ export async function POST(request: Request) {
'Content-Type': file.type,
});
// Construct public URL
// In a real production env, this should be an env var like NEXT_PUBLIC_STORAGE_URL
const url = `http://localhost:9000/${bucketName}/${filename}`;
const url = `/api/files/${filename}`;
return NextResponse.json({ url });
return NextResponse.json({ url, path: filename });
} catch (error) {
console.error('Upload error:', error);
return NextResponse.json({ error: 'Error uploading file' }, { status: 500 });