Стартовый проект с роутерами

This commit is contained in:
2024-07-31 17:24:45 +09:00
parent ece09af415
commit da2ae23831
9 changed files with 112 additions and 2 deletions

24
backend-app/main.py Normal file
View File

@ -0,0 +1,24 @@
import uvicorn
from fastapi import FastAPI, HTTPException
from fastapi.responses import ORJSONResponse
from core.settings import settings
from api.main_router import router as main_router
from api.another_router import router as another_router
app = FastAPI(default_response_class=ORJSONResponse)
#api/hello
app.include_router(
router=main_router,
prefix="/api",
tags=["Основной роутер"]
)
app.include_router(
router=another_router,
prefix="/another",
tags=["Побочный роутер"]
)
if __name__ == "__main__":
uvicorn.run(app, host=settings.run.host, port=settings.run.port)