Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .v0-boot-light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .v0-catalog-light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .v0-output-light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1,705 changes: 992 additions & 713 deletions package-lock.json

Large diffs are not rendered by default.

31 changes: 31 additions & 0 deletions src/app/api/registry/route.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import { NextRequest, NextResponse } from 'next/server';
import { registryAdapters, RegistryType } from '@/lib/registries';

export async function GET(request: NextRequest) {
const searchParams = request.nextUrl.searchParams;
const query = searchParams.get('q');
const registry = searchParams.get('registry') as RegistryType;
const limit = parseInt(searchParams.get('limit') || '20');

if (!query) {
return NextResponse.json({ error: 'Query parameter "q" is required' }, { status: 400 });
}

if (!registry) {
return NextResponse.json({ error: 'Registry parameter is required' }, { status: 400 });
}

const adapter = registryAdapters[registry];
if (!adapter) {
return NextResponse.json({ error: `Unknown registry: ${registry}` }, { status: 400 });
}

try {
const results = await adapter.search(query, limit);
const packages = results.map((r) => adapter.toPackage(r));
return NextResponse.json({ packages, count: packages.length });
} catch (error) {
console.error(`Registry search error (${registry}):`, error);
return NextResponse.json({ error: 'Search failed', packages: [], count: 0 }, { status: 500 });
}
}
Loading
Loading