24 lines
474 B
Python
24 lines
474 B
Python
from contextlib import asynccontextmanager
|
|
from pathlib import Path
|
|
|
|
from fastapi import FastAPI
|
|
from fastapi.responses import FileResponse
|
|
|
|
from database import init_db
|
|
from routers import router
|
|
|
|
|
|
@asynccontextmanager
|
|
async def lifespan(_: FastAPI):
|
|
init_db()
|
|
yield
|
|
|
|
|
|
app = FastAPI(title="ADa Workshop", lifespan=lifespan)
|
|
app.include_router(router)
|
|
|
|
|
|
@app.get("/", response_class=FileResponse)
|
|
def workshop():
|
|
return Path(__file__).with_name("workshop.html")
|