|  | from fastapi import FastAPI | 
					
						
						|  | from fastapi.responses import JSONResponse | 
					
						
						|  | from fastapi.requests import Request | 
					
						
						|  | from fastapi.security.utils import get_authorization_scheme | 
					
						
						|  | from sqlalchemy.ext.asyncio import create_async_engine, AsyncSession | 
					
						
						|  | from sqlalchemy.orm import sessionmaker | 
					
						
						|  | from app.models import Base | 
					
						
						|  | from app.routers import users, teams | 
					
						
						|  |  | 
					
						
						|  | app = FastAPI() | 
					
						
						|  |  | 
					
						
						|  | engine = create_async_engine("sqlite:///database.db") | 
					
						
						|  | async_session = sessionmaker(engine, class_=AsyncSession, expire_on_commit=False) | 
					
						
						|  |  | 
					
						
						|  | @app.on_event("startup") | 
					
						
						|  | async def startup(): | 
					
						
						|  | async with engine.begin() as conn: | 
					
						
						|  | await conn.run_sync(Base.metadata.create_all) | 
					
						
						|  |  | 
					
						
						|  | @app.on_event("shutdown") | 
					
						
						|  | async def shutdown(): | 
					
						
						|  | await engine.dispose() |