init
This commit is contained in:
18
app/main.py
Normal file
18
app/main.py
Normal file
@@ -0,0 +1,18 @@
|
||||
from fastapi import FastAPI
|
||||
from . import database, models, api
|
||||
|
||||
from app.api import router as api_router
|
||||
|
||||
app = FastAPI()
|
||||
|
||||
app.include_router(api_router, prefix="/api")
|
||||
|
||||
@app.on_event("startup")
|
||||
async def startup():
|
||||
async with database.engine.begin() as conn:
|
||||
await conn.run_sync(models.Base.metadata.create_all)
|
||||
|
||||
@app.get("/{full_path:path}")
|
||||
async def serve_spa(full_path: str):
|
||||
index_path = os.path.join(dist_path, "index.html")
|
||||
return FileResponse(index_path)
|
||||
Reference in New Issue
Block a user