File size: 538 Bytes
e439b9e
 
d74863e
e439b9e
 
 
f89dbd6
e439b9e
 
f89dbd6
d74863e
e439b9e
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
from contextlib import asynccontextmanager
from fastapi import FastAPI

@asynccontextmanager
async def lifespan(app: FastAPI):
    # الجزء ده بيتنفذ أول ما السيرفر يفتح
    print("🚀 AIdea API starting up...")
    yield
    # الجزء ده بيتنفذ لما السيرفر يقفل
    print("🛑 AIdea API shutting down...")

# تعريف الـ app مع إضافة الـ lifespan
app = FastAPI(lifespan=lifespan)

# ... باقي الـ Routes بتاعتك (auth, notes, etc.) تفضل زي ما هي