Точка входа backend API
This commit is contained in:
@@ -4,7 +4,7 @@ from fastapi.responses import FileResponse
|
||||
from pathlib import Path
|
||||
|
||||
# Импорт роутера
|
||||
from .routes.license_routes import router as license_router # Изменено: один dot вместо двух
|
||||
from .routes.license_routes import router as license_router
|
||||
|
||||
# Путь к корню проекта
|
||||
BASE_DIR = Path(__file__).resolve().parent
|
||||
@@ -24,9 +24,21 @@ def create_app() -> FastAPI:
|
||||
apps.include_router(license_router, prefix="/api")
|
||||
|
||||
# Монтируем статические папки фронтенда
|
||||
apps.mount("/static/css", StaticFiles(directory=BASE_DIR.parent / "frontend" / "css"), name="css")
|
||||
apps.mount("/static/js", StaticFiles(directory=BASE_DIR.parent / "frontend" / "js"), name="js")
|
||||
apps.mount("/static/assets", StaticFiles(directory=BASE_DIR.parent / "frontend" / "assets"), name="assets")
|
||||
apps.mount(
|
||||
"/static/css",
|
||||
StaticFiles(directory=BASE_DIR.parent / "frontend" / "css"),
|
||||
name="css"
|
||||
)
|
||||
apps.mount(
|
||||
"/static/js",
|
||||
StaticFiles(directory=BASE_DIR.parent / "frontend" / "js"),
|
||||
name="js"
|
||||
)
|
||||
apps.mount(
|
||||
"/static/assets",
|
||||
StaticFiles(directory=BASE_DIR.parent / "frontend" / "assets"),
|
||||
name="assets"
|
||||
)
|
||||
|
||||
# Отдача главной страницы
|
||||
@apps.get("/", include_in_schema=False)
|
||||
@@ -34,7 +46,9 @@ def create_app() -> FastAPI:
|
||||
"""
|
||||
Отдает главную страницу сайта (index.html)
|
||||
"""
|
||||
return FileResponse(BASE_DIR.parent / "frontend" / "templates" / "index.html")
|
||||
index_file = BASE_DIR.parent / "frontend" / "templates" / "index.html"
|
||||
return FileResponse(index_file)
|
||||
|
||||
return apps
|
||||
|
||||
# Экземпляр приложения
|
||||
|
||||
Reference in New Issue
Block a user