async (not working tbh)
This commit is contained in:
@ -2,7 +2,7 @@ from typing import Union
|
||||
from fastapi import FastAPI, Depends
|
||||
|
||||
from .db import models
|
||||
from .db.database import SessionLocal, engine
|
||||
from .db.database import engine
|
||||
from .dependencies import get_db
|
||||
|
||||
from .views.auth.api import router as auth_router
|
||||
@ -10,13 +10,19 @@ from .views.queue.api import router as queue_router
|
||||
from .views.news.api import router as news_router
|
||||
|
||||
app = FastAPI(dependencies=[Depends(get_db)])
|
||||
models.Base.metadata.create_all(bind=engine)
|
||||
|
||||
|
||||
app.include_router(queue_router)
|
||||
app.include_router(auth_router)
|
||||
app.include_router(news_router)
|
||||
|
||||
|
||||
@app.on_event("startup")
|
||||
async def init_tables():
|
||||
async with engine.begin() as conn:
|
||||
await conn.run_sync(models.Base.metadata.create_all)
|
||||
|
||||
|
||||
@app.get("/")
|
||||
async def read_root():
|
||||
return {"message": "OK"}
|
||||
|
||||
Reference in New Issue
Block a user