added fetch image by id endpoint
This commit is contained in:
@@ -7,18 +7,6 @@ import 'dotenv/config'
|
||||
|
||||
const uploadDir = process.env.UPLOAD_DIR!;
|
||||
|
||||
export async function GET() {
|
||||
try {
|
||||
const files = await fs.readdir(uploadDir);
|
||||
const images = files.filter(file =>
|
||||
/\.(jpg|jpeg|png)$/i.test(file)
|
||||
);
|
||||
|
||||
return httpResponse({ images }, 200);
|
||||
} catch (error) {
|
||||
return httpResponse({ error: `Failed to read images ${error}` }, 500);
|
||||
}
|
||||
}
|
||||
|
||||
export async function POST({ request }: APIContext) {
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user