MCPcopy Create free account
hub / github.com/AsyncFuncAI/deepwiki-open / root

Function root

api/api.py:550–574  ·  view source on GitHub ↗

Root endpoint to check if the API is running and list available endpoints dynamically.

()

Source from the content-addressed store, hash-verified

548
549@app.get("/")
550async def root():
551 """Root endpoint to check if the API is running and list available endpoints dynamically."""
552 # Collect routes dynamically from the FastAPI app
553 endpoints = {}
554 for route in app.routes:
555 if hasattr(route, "methods") and hasattr(route, "path"):
556 # Skip docs and static routes
557 if route.path in ["/openapi.json", "/docs", "/redoc", "/favicon.ico"]:
558 continue
559 # Group endpoints by first path segment
560 path_parts = route.path.strip("/").split("/")
561 group = path_parts[0].capitalize() if path_parts[0] else "Root"
562 method_list = list(route.methods - {"HEAD", "OPTIONS"})
563 for method in method_list:
564 endpoints.setdefault(group, []).append(f"{method} {route.path}")
565
566 # Optionally, sort endpoints for readability
567 for group in endpoints:
568 endpoints[group].sort()
569
570 return {
571 "message": "Welcome to Streaming API",
572 "version": "1.0.0",
573 "endpoints": endpoints
574 }
575
576# --- Processed Projects Endpoint --- (New Endpoint)
577@app.get("/api/processed_projects", response_model=List[ProcessedProjectEntry])

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected