mirror of
https://github.com/TronoSfera/Law.git
synced 2026-05-18 10:03:45 +03:00
30 lines
881 B
Python
30 lines
881 B
Python
from pathlib import Path
|
|
from fastapi import FastAPI
|
|
from fastapi.middleware.cors import CORSMiddleware
|
|
from fastapi.responses import FileResponse
|
|
from app.core.config import settings
|
|
from app.api.public.router import router as public_router
|
|
from app.api.admin.router import router as admin_router
|
|
|
|
app = FastAPI(title=settings.APP_NAME, version="0.1.0")
|
|
BASE_DIR = Path(__file__).resolve().parent
|
|
LANDING_FILE = BASE_DIR / "web" / "landing.html"
|
|
|
|
app.add_middleware(
|
|
CORSMiddleware,
|
|
allow_origins=settings.cors_origins_list,
|
|
allow_credentials=True,
|
|
allow_methods=["*"],
|
|
allow_headers=["*"],
|
|
)
|
|
|
|
app.include_router(public_router, prefix="/api/public")
|
|
app.include_router(admin_router, prefix="/api/admin")
|
|
|
|
@app.get("/", include_in_schema=False)
|
|
def landing():
|
|
return FileResponse(LANDING_FILE)
|
|
|
|
@app.get("/health")
|
|
def health():
|
|
return {"status": "ok"}
|