Created Queries and Execute endpoint
This commit is contained in:
29
main.py
29
main.py
@@ -1,26 +1,19 @@
|
||||
from contextlib import asynccontextmanager
|
||||
|
||||
from fastapi import FastAPI
|
||||
from data.db import engine, Base
|
||||
|
||||
from app.connections import connections_router
|
||||
from app.users import users_router
|
||||
from app import api_router
|
||||
|
||||
app = FastAPI()
|
||||
|
||||
app.include_router(router=users_router, prefix="/users", tags=["Users"])
|
||||
app.include_router(
|
||||
router=connections_router, prefix="/connections", tags=["Connections"]
|
||||
)
|
||||
from utils.scripts import pools_creator, pools_destroy, db_startup
|
||||
|
||||
|
||||
# @app.on_event("startup")
|
||||
async def startup():
|
||||
async with engine.begin() as conn:
|
||||
await conn.run_sync(Base.metadata.create_all)
|
||||
|
||||
|
||||
# import asyncio
|
||||
# asyncio.run(startup())
|
||||
@asynccontextmanager
|
||||
async def lifespan(app: FastAPI):
|
||||
await pools_creator()
|
||||
yield
|
||||
await pools_destroy()
|
||||
|
||||
# import uvicorn
|
||||
|
||||
# uvicorn.run(app=app)
|
||||
app = FastAPI(lifespan=lifespan)
|
||||
app.include_router(router=api_router)
|
||||
Reference in New Issue
Block a user