feat: front end for login

This commit is contained in:
2025-06-14 10:02:02 -04:00
parent df5b247cdd
commit 2729ba49f2
18 changed files with 531 additions and 68 deletions
+10
View File
@@ -1,4 +1,5 @@
from fastapi import FastAPI, Depends, HTTPException, status
from fastapi.middleware.cors import CORSMiddleware
from fastapi.security import OAuth2PasswordRequestForm
from sqlalchemy.orm import Session
@@ -10,6 +11,14 @@ Base.metadata.create_all(bind=engine)
app = FastAPI()
app.add_middleware(
CORSMiddleware,
allow_origins=["http://localhost:3000", "https://localhost:3000"],
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
)
# Dependency
def get_db():
@@ -81,4 +90,5 @@ def register_user(user: schemas.UserCreate, db: Session = Depends(get_db)):
status_code=status.HTTP_400_BAD_REQUEST,
detail="Account with that email already registered",
)
# Default Cases
return crud.create_user(db, user)