snapshot of https://github.com/shadcn-ui/ui.git (main, 2026-09-15; blobs > 131072B omitted)
This commit is contained in:
29
apps/v4/app/(app)/(create)/init/md/route.ts
Normal file
29
apps/v4/app/(app)/(create)/init/md/route.ts
Normal file
@@ -0,0 +1,29 @@
|
||||
import { type NextRequest } from "next/server"
|
||||
import { track } from "@vercel/analytics/server"
|
||||
|
||||
import { buildInstructions } from "@/app/(app)/(create)/lib/build-instructions"
|
||||
import { parseDesignSystemConfig } from "@/app/(app)/(create)/lib/parse-config"
|
||||
|
||||
export async function GET(request: NextRequest) {
|
||||
try {
|
||||
const searchParams = request.nextUrl.searchParams
|
||||
const result = parseDesignSystemConfig(searchParams)
|
||||
|
||||
if (!result.success) {
|
||||
return new Response(result.error, { status: 400 })
|
||||
}
|
||||
|
||||
track("create_app_manual", result.data)
|
||||
|
||||
const markdown = buildInstructions(result.data)
|
||||
|
||||
return new Response(markdown, {
|
||||
headers: { "Content-Type": "text/markdown; charset=utf-8" },
|
||||
})
|
||||
} catch (error) {
|
||||
return new Response(
|
||||
error instanceof Error ? error.message : "An unknown error occurred",
|
||||
{ status: 500 }
|
||||
)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user