@@ -12,6 +12,17 @@ import { saveMarkdown, loadMarkdown } from '@/lib/storage'
1212import { useToast } from "@/components/ui/use-toast"
1313import { DiscoveredPage } from '@/lib/types'
1414
15+ /**
16+ * Renders the main interface for the DevDocs application.
17+ *
18+ * This component provides the entry point for users to discover, crawl, and extract documentation
19+ * from a specified URL. It validates user input, triggers API requests via Next.js API routes
20+ * to retrieve and crawl pages, and manages state to display processing status, discovered pages,
21+ * extracted markdown content, and related statistics. Child components handle URL input,
22+ * status display, subdomain listing, markdown output, stored files, and configuration settings.
23+ *
24+ * @returns The rendered Home component as JSX.
25+ */
1526export default function Home ( ) {
1627 const [ url , setUrl ] = useState ( '' )
1728 const [ isProcessing , setIsProcessing ] = useState ( false )
@@ -168,11 +179,10 @@ export default function Home() {
168179 } ) )
169180 )
170181
171- // Make a direct request to the backend API instead of using the crawlPages function
172- const backendUrl = process . env . NEXT_PUBLIC_BACKEND_URL || process . env . BACKEND_URL || 'http://localhost:24125'
173- console . log ( 'Making direct request to backend:' , `${ backendUrl } /api/crawl` )
182+ // Use the Next.js API route instead of direct backend request
183+ console . log ( 'Making request to Next.js API route: /api/crawl' )
174184
175- const response = await fetch ( `${ backendUrl } /api/crawl` , {
185+ const response = await fetch ( `/api/crawl` , {
176186 method : 'POST' ,
177187 headers : {
178188 'Content-Type' : 'application/json' ,
0 commit comments