@@ -0,0 +1,26 @@
|
||||
import { NextRequest, NextResponse } from 'next/server';
|
||||
import { albumDb } from '@/lib/db';
|
||||
|
||||
export async function GET(
|
||||
request: NextRequest,
|
||||
{ params }: { params: { id: string } }
|
||||
) {
|
||||
try {
|
||||
const album = albumDb.getById(params.id);
|
||||
|
||||
if (!album) {
|
||||
return NextResponse.json(
|
||||
{ error: 'Album not found' },
|
||||
{ status: 404 }
|
||||
);
|
||||
}
|
||||
|
||||
return NextResponse.json(album, { status: 200 });
|
||||
} catch (error) {
|
||||
console.error('Error fetching album:', error);
|
||||
return NextResponse.json(
|
||||
{ error: 'Failed to fetch album' },
|
||||
{ status: 500 }
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user