WIP: Frontend implementation #1
1 changed files with 12 additions and 0 deletions
backend: CORS Support
commit
9df2ee08d2
|
|
@ -10,12 +10,24 @@ from .auth import (
|
|||
create_access_token, get_password_hash,
|
||||
)
|
||||
from fastapi.security import OAuth2PasswordRequestForm
|
||||
from fastapi.middleware.cors import CORSMiddleware
|
||||
|
||||
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
|
||||
Base.metadata.create_all(bind=engine)
|
||||
|
||||
@app.options("/{path:path}")
|
||||
def preflight_handler(path: str):
|
||||
return {}
|
||||
|
||||
@app.post("/auth/register", response_model=schemas.UserRead)
|
||||
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()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue