33 lines
744 B
Python
33 lines
744 B
Python
from __future__ import annotations
|
|
|
|
from fastapi import FastAPI
|
|
from fastapi.middleware.cors import CORSMiddleware
|
|
|
|
from app.config import settings
|
|
from app.database import Base, engine
|
|
from app.routers import actions, auth, workouts
|
|
|
|
app = FastAPI(title="Benchpress Secret", version="0.1.0")
|
|
|
|
app.add_middleware(
|
|
CORSMiddleware,
|
|
allow_origins=settings.cors_origin_list,
|
|
allow_credentials=True,
|
|
allow_methods=["*"],
|
|
allow_headers=["*"],
|
|
)
|
|
|
|
app.include_router(auth.router)
|
|
app.include_router(workouts.router)
|
|
app.include_router(actions.router)
|
|
|
|
|
|
@app.on_event("startup")
|
|
def on_startup() -> None:
|
|
Base.metadata.create_all(bind=engine)
|
|
|
|
|
|
@app.get("/api/health")
|
|
def health() -> dict[str, str]:
|
|
return {"status": "ok"}
|