Simplified templating, backend port config on devserver.py, simplified Vue app patches.
This commit is contained in:
+8
-15
@@ -1,17 +1,12 @@
|
||||
"""Main FastAPI application."""
|
||||
|
||||
from contextlib import asynccontextmanager
|
||||
from pathlib import Path
|
||||
|
||||
from fastapi import FastAPI
|
||||
from fastapi_vue import Frontend
|
||||
|
||||
# Frontend static file server - configure options here
|
||||
# Vue Frontend static files
|
||||
frontend = Frontend(
|
||||
Path(__file__).parent / "frontend-build",
|
||||
spa=True,
|
||||
favicon="/assets/favicon",
|
||||
cached=["/assets/"],
|
||||
Path(__file__).with_name("frontend-build"), spa=True, cached=["/assets/"]
|
||||
)
|
||||
|
||||
|
||||
@@ -22,19 +17,17 @@ async def lifespan(app: FastAPI):
|
||||
yield
|
||||
|
||||
|
||||
app = FastAPI(title="{{PROJECT_TITLE}}", lifespan=lifespan)
|
||||
app = FastAPI(title="PROJECT_TITLE", lifespan=lifespan)
|
||||
|
||||
|
||||
# Add API routes here...
|
||||
|
||||
|
||||
# Health check endpoint for the Vue demo app to verify the backend is running
|
||||
@app.get("/api/health")
|
||||
async def health_check():
|
||||
"""Health check endpoint for the dev server."""
|
||||
return {"status": "ok"}
|
||||
|
||||
|
||||
# Add your API routes here
|
||||
# @app.get("/api/example")
|
||||
# async def example():
|
||||
# return {"message": "Hello World"}
|
||||
|
||||
|
||||
# Final catch-all route for frontend files (keep at end of file)
|
||||
frontend.route(app, "/")
|
||||
|
||||
Reference in New Issue
Block a user