Some checks failed
Dev Deployment (Zero Downtime) / deploy-dev (push) Failing after 7m26s
Remove unused imports, replace `any` types with proper interfaces in directus.ts and i18n-loader.ts, exclude scripts/ and coverage/ from ESLint, and fix unused variable warnings across the codebase. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
19 lines
607 B
TypeScript
19 lines
607 B
TypeScript
import { NextRequest, NextResponse } from 'next/server';
|
|
import { getSnippets } from '@/lib/directus';
|
|
|
|
export async function GET(request: NextRequest) {
|
|
try {
|
|
const { searchParams } = new URL(request.url);
|
|
const limit = parseInt(searchParams.get('limit') || '10');
|
|
const featured = searchParams.get('featured') === 'true' ? true : undefined;
|
|
|
|
const snippets = await getSnippets(limit, featured);
|
|
|
|
return NextResponse.json({
|
|
snippets: snippets || []
|
|
});
|
|
} catch (_error) {
|
|
return NextResponse.json({ error: 'Failed to fetch snippets' }, { status: 500 });
|
|
}
|
|
}
|