knowledge-base / main.py
gavinzli's picture
Remove unused binary files and refactor main application structure to integrate FastAPI with new routing and utility functions.
c7426d8
raw
history blame
757 Bytes
"""Module to handle the main FastAPI application and its endpoints."""
import logging
from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
from router import main
app = FastAPI(docs_url="/")
app.include_router(main.router, tags=["content"])
origins = [
"*"
]
app.add_middleware(
CORSMiddleware,
allow_origins=origins,
allow_credentials = True,
allow_methods=["*"],
allow_headers=["*"],
)
logging.basicConfig(
format='%(asctime)s - %(levelname)s - %(funcName)s - %(message)s')
logging.getLogger().setLevel(logging.ERROR)
@app.get("/_health")
def health():
"""
Returns the health status of the application.
:return: A string "OK" indicating the health status.
"""
return "OK"