pythonasyncioapiasyncfastapiframeworkjsonjson-schemaopenapiopenapi3pydanticpython-typespython3redocreststarletteswaggerswagger-uiuvicornweb
14 lines
228 B
14 lines
228 B
from fastapi import FastAPI, Form
|
|
from pydantic import BaseModel
|
|
|
|
app = FastAPI()
|
|
|
|
|
|
class FormData(BaseModel):
|
|
username: str
|
|
password: str
|
|
|
|
|
|
@app.post("/login/")
|
|
async def login(data: FormData = Form()):
|
|
return data
|
|
|