feat(infrastructure): add basic project deployment

This commit is contained in:
2025-09-23 23:47:17 +02:00
parent c7d33465ca
commit f4c2b28864
16 changed files with 241 additions and 24 deletions

View File

@@ -1,11 +1,24 @@
from fastapi import Depends, FastAPI
from fastapi.middleware.cors import CORSMiddleware
from .db import User, create_db_and_tables
from .schemas import UserCreate, UserRead, UserUpdate
from .users import auth_backend, current_active_user, fastapi_users
from .users import auth_backend, current_active_verified_user, fastapi_users
app = FastAPI()
# CORS for frontend dev server
app.add_middleware(
CORSMiddleware,
allow_origins=[
"http://localhost:5173",
"http://127.0.0.1:5173",
],
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
)
app.include_router(
fastapi_users.get_auth_router(auth_backend), prefix="/auth/jwt", tags=["auth"]
)
@@ -32,7 +45,7 @@ app.include_router(
@app.get("/authenticated-route")
async def authenticated_route(user: User = Depends(current_active_user)):
async def authenticated_route(user: User = Depends(current_active_verified_user)):
return {"message": f"Hello {user.email}!"}