29 lines
670 B
Python
29 lines
670 B
Python
from typing import Union
|
|
from fastapi import FastAPI, Depends
|
|
|
|
from .db import models
|
|
from .db.database import engine
|
|
from .dependencies import get_db
|
|
|
|
from .views.auth.api import router as auth_router
|
|
from .views.queue.api import router as queue_router
|
|
from .views.news.api import router as news_router
|
|
|
|
app = FastAPI(dependencies=[Depends(get_db)])
|
|
|
|
|
|
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"}
|