Skip to content

Commit 3e3d6ef

Browse files
📝 Add docstrings to main
Docstrings generation was requested by @Shubham-Khichi. * #45 (comment) The following files were modified: * `app/page.tsx`
1 parent 20edbea commit 3e3d6ef

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

app/page.tsx

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,17 @@ import { saveMarkdown, loadMarkdown } from '@/lib/storage'
1212
import { useToast } from "@/components/ui/use-toast"
1313
import { 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+
*/
1526
export 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

Comments
 (0)