feat: front end for login
This commit was merged in pull request #5.
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user