amaye15
commited on
Commit
·
8a2df9f
1
Parent(s):
77e5676
Feat - Docs - Main Page
Browse files
main.py
CHANGED
|
@@ -2,7 +2,7 @@ import asyncio, os
|
|
| 2 |
from fastapi import FastAPI, HTTPException, BackgroundTasks, Request
|
| 3 |
from fastapi.responses import JSONResponse
|
| 4 |
from fastapi import FastAPI, HTTPException, Request
|
| 5 |
-
from fastapi.responses import HTMLResponse, JSONResponse
|
| 6 |
from fastapi.staticfiles import StaticFiles
|
| 7 |
from fastapi.middleware.cors import CORSMiddleware
|
| 8 |
from fastapi.templating import Jinja2Templates
|
|
@@ -402,12 +402,17 @@ async def shutdown_event():
|
|
| 402 |
await crawler_service.stop()
|
| 403 |
|
| 404 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 405 |
@app.get("/")
|
| 406 |
-
def
|
| 407 |
-
|
| 408 |
-
return RedirectResponse(url="/mkdocs")
|
| 409 |
-
# Return a json response
|
| 410 |
-
return {"message": "Crawl4AI API service is running"}
|
| 411 |
|
| 412 |
|
| 413 |
@app.post("/crawl", dependencies=[secure_endpoint()] if CRAWL4AI_API_TOKEN else [])
|
|
|
|
| 2 |
from fastapi import FastAPI, HTTPException, BackgroundTasks, Request
|
| 3 |
from fastapi.responses import JSONResponse
|
| 4 |
from fastapi import FastAPI, HTTPException, Request
|
| 5 |
+
from fastapi.responses import HTMLResponse, JSONResponse, RedirectResponse
|
| 6 |
from fastapi.staticfiles import StaticFiles
|
| 7 |
from fastapi.middleware.cors import CORSMiddleware
|
| 8 |
from fastapi.templating import Jinja2Templates
|
|
|
|
| 402 |
await crawler_service.stop()
|
| 403 |
|
| 404 |
|
| 405 |
+
# @app.get("/")
|
| 406 |
+
# def read_root():
|
| 407 |
+
# if os.path.exists(__location__ + "/site"):
|
| 408 |
+
# return RedirectResponse(url="/mkdocs")
|
| 409 |
+
# # Return a json response
|
| 410 |
+
# return {"message": "Crawl4AI API service is running"}
|
| 411 |
+
|
| 412 |
+
|
| 413 |
@app.get("/")
|
| 414 |
+
async def root():
|
| 415 |
+
return RedirectResponse(url="/docs")
|
|
|
|
|
|
|
|
|
|
| 416 |
|
| 417 |
|
| 418 |
@app.post("/crawl", dependencies=[secure_endpoint()] if CRAWL4AI_API_TOKEN else [])
|