mirror of
https://github.com/fastapi/fastapi.git
synced 2025-12-24 22:59:32 -05:00
16 lines
267 B
Python
16 lines
267 B
Python
from fastapi import FastAPI, Form
|
|
from pydantic import BaseModel
|
|
|
|
app = FastAPI()
|
|
|
|
|
|
class FormData(BaseModel):
|
|
username: str
|
|
password: str
|
|
model_config = {"extra": "forbid"}
|
|
|
|
|
|
@app.post("/login/")
|
|
async def login(data: FormData = Form()):
|
|
return data
|