2024-11-02 12:38:05 +01:00
|
|
|
import asyncio
|
2024-10-27 11:51:53 +01:00
|
|
|
from contextlib import asynccontextmanager
|
2024-10-19 15:55:51 +02:00
|
|
|
from fastapi import FastAPI
|
2024-11-02 12:38:05 +01:00
|
|
|
from database import create_db_and_tables
|
|
|
|
|
from middleware.create_user import create_user
|
2024-10-19 15:55:51 +02:00
|
|
|
from routes.main import api_router
|
2024-10-27 15:56:43 +01:00
|
|
|
|
|
|
|
|
|
2024-10-27 11:51:53 +01:00
|
|
|
@asynccontextmanager
|
|
|
|
|
async def lifespan(app: FastAPI):
|
2024-11-02 12:38:05 +01:00
|
|
|
await create_db_and_tables()
|
|
|
|
|
await create_user("soluce.technologies@gmail.com", "12345678", True)
|
2024-10-27 15:56:43 +01:00
|
|
|
|
2024-10-27 11:51:53 +01:00
|
|
|
yield
|
|
|
|
|
|
|
|
|
|
|
2024-11-02 12:38:05 +01:00
|
|
|
app = FastAPI(lifespan=lifespan)
|
2024-10-19 15:55:51 +02:00
|
|
|
app.include_router(api_router)
|