-
-
Notifications
You must be signed in to change notification settings - Fork 8.5k
Closed
Labels
Description
My angular side code is:
<form aria-labelledby="title" ngNoForm [action]="url" method="POST">
<input type="text" name="email" value="" nbInput fullWidth placeholder="Email Address" >
<input type="text" name="password" value="" nbInput fullWidth placeholder="Password" >
<button nbButton fullWidth status="primary" class="mbt" (click)="login()">Login</button >
</form>
The url will be directed to "http://127.0.0.1:8000/getLogin"
Now, I want to fetch details in the fastapi route, but I am unable to fetch. Can anyone answer?
I tried below code:
from fastapi import FastAPI
app = FastAPI()
class userForm(BaseModel):
email: str = Form(...)
password: str = Form(...)
@app.post('/getLogin' )
def getLogin(request: Request,userForm: userForm ):
email = userForm.email
password = userForm.password
print(email,password)
return json.dumps({"reaction":12})You can see I am getting password and email below but how to get that in my code.
