Yassine Mhirsi commited on
Commit
b0001af
·
1 Parent(s): 170053d

Redirect root endpoint to API documentation instead of returning API information

Browse files
Files changed (1) hide show
  1. routes/root.py +4 -16
routes/root.py CHANGED
@@ -1,25 +1,13 @@
1
  """Root endpoint for API information"""
2
 
3
  from fastapi import APIRouter
 
4
 
5
  router = APIRouter()
6
 
7
 
8
- @router.get("/", response_model=dict, tags=["General"])
9
  async def root():
10
- """Root endpoint with API information"""
11
- return {
12
- "message": "NLP Project API",
13
- "version": "1.0.0",
14
- "features": {
15
- "stance_detection": {
16
- "predict": "/predict",
17
- "batch_predict": "/batch-predict"
18
- }
19
- },
20
- "endpoints": {
21
- "health": "/health",
22
- "docs": "/docs"
23
- }
24
- }
25
 
 
1
  """Root endpoint for API information"""
2
 
3
  from fastapi import APIRouter
4
+ from fastapi.responses import RedirectResponse
5
 
6
  router = APIRouter()
7
 
8
 
9
+ @router.get("/", include_in_schema=False)
10
  async def root():
11
+ """Redirect root to API documentation"""
12
+ return RedirectResponse(url="/docs")
 
 
 
 
 
 
 
 
 
 
 
 
 
13