WIP: Frontend implementation #1

Draft
fager wants to merge 19 commits from ch-frontend into main
Showing only changes of commit 9df2ee08d2 - Show all commits

backend: CORS Support

Frank Agerholm 2026-01-25 17:00:35 +01:00
No known key found for this signature in database

View file

@ -10,12 +10,24 @@ from .auth import (
create_access_token, get_password_hash, create_access_token, get_password_hash,
) )
from fastapi.security import OAuth2PasswordRequestForm from fastapi.security import OAuth2PasswordRequestForm
from fastapi.middleware.cors import CORSMiddleware
app = FastAPI(title="Server Worklog") app = FastAPI(title="Server Worklog")
app.add_middleware(
CORSMiddleware,
allow_origins=["*"], # oder deine echte Domain
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
)
# Nur für lokale Entwicklung, in Produktion via Alembic # Nur für lokale Entwicklung, in Produktion via Alembic
Base.metadata.create_all(bind=engine) Base.metadata.create_all(bind=engine)
@app.options("/{path:path}")
def preflight_handler(path: str):
return {}
@app.post("/auth/register", response_model=schemas.UserRead) @app.post("/auth/register", response_model=schemas.UserRead)
def register_user(user_in: schemas.UserCreate, db: Session = Depends(get_db)): def register_user(user_in: schemas.UserCreate, db: Session = Depends(get_db)):
existing = db.query(models.User).filter(models.User.username == user_in.username).first() existing = db.query(models.User).filter(models.User.username == user_in.username).first()