Add Workshop MVP
This commit is contained in:
23
main.py
Normal file
23
main.py
Normal file
@@ -0,0 +1,23 @@
|
||||
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")
|
||||
Reference in New Issue
Block a user