Skip to content
Closed
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
18 changes: 14 additions & 4 deletions app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,17 @@ import { saveMarkdown, loadMarkdown } from '@/lib/storage'
import { useToast } from "@/components/ui/use-toast"
import { DiscoveredPage } from '@/lib/types'

/**
* Renders the main interface for the DevDocs application.
*
* This component provides the entry point for users to discover, crawl, and extract documentation
* from a specified URL. It validates user input, triggers API requests via Next.js API routes
* to retrieve and crawl pages, and manages state to display processing status, discovered pages,
* extracted markdown content, and related statistics. Child components handle URL input,
* status display, subdomain listing, markdown output, stored files, and configuration settings.
*
* @returns The rendered Home component as JSX.
*/
export default function Home() {
const [url, setUrl] = useState('')
const [isProcessing, setIsProcessing] = useState(false)
Expand Down Expand Up @@ -168,11 +179,10 @@ export default function Home() {
}))
)

// Make a direct request to the backend API instead of using the crawlPages function
const backendUrl = process.env.NEXT_PUBLIC_BACKEND_URL || process.env.BACKEND_URL || 'http://localhost:24125'
console.log('Making direct request to backend:', `${backendUrl}/api/crawl`)
// Use the Next.js API route instead of direct backend request
console.log('Making request to Next.js API route: /api/crawl')

const response = await fetch(`${backendUrl}/api/crawl`, {
const response = await fetch(`/api/crawl`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Expand Down