Skip to content

UI Library for Design Engineers. Animated components and effects you can copy and paste into your apps. Free. Open Source.

fix: remove unused route

Dillion Verma003f6f73f17a
diff --git a/app/registry/[name]/route.ts b/app/registry/[name]/route.ts
deleted file mode 100644
index f6f71b6c..00000000
--- a/app/registry/[name]/route.ts
+++ /dev/null
@@ -1,57 +0,0 @@
-import { promises as fs } from "fs";
-import { NextResponse } from "next/server";
-import path from "path";
-import { registryItemSchema } from "shadcn/registry";
-
-// This route shows an example for serving a component using a route handler.
-export async function GET(
- request: Request,
- { params }: { params: { name: string } },
-) {
- try {
- const { name } = params;
- // Cache the registry import
- const registryData = await import("@/registry.json");
- const registry = registryData.default;
-
- // Find the component from the registry.
- const component = registry.items.find((c) => c.name === name);
-
- // If the component is not found, return a 404 error.
- if (!component) {
- return NextResponse.json(
- { error: "Component not found" },
- { status: 404 },
- );
- }
-
- // Validate before file operations.
- const registryItem = registryItemSchema.parse(component);
-
- // If the component has no files, return a 400 error.
- if (!registryItem.files?.length) {
- return NextResponse.json(
- { error: "Component has no files" },
- { status: 400 },
- );
- }
-
- // Read all files in parallel.
- const filesWithContent = await Promise.all(
- registryItem.files.map(async (file) => {
- const filePath = path.join(process.cwd(), file.path);
- const content = await fs.readFile(filePath, "utf8");
- return { ...file, content };
- }),
- );
-
- // Return the component with the files.
- return NextResponse.json({ ...registryItem, files: filesWithContent });
- } catch (error) {
- console.error("Error processing component request:", error);
- return NextResponse.json(
- { error: "Something went wrong" },
- { status: 500 },
- );
- }
-}