mirror of
https://github.com/fastapi/fastapi.git
synced 2026-02-19 23:44:51 -05:00
19 lines
353 B
Python
19 lines
353 B
Python
from fastapi import FastAPI
|
|
from pydantic import BaseModel
|
|
from pydantic.types import EmailStr
|
|
|
|
app = FastAPI()
|
|
|
|
|
|
class UserIn(BaseModel):
|
|
username: str
|
|
password: str
|
|
email: EmailStr
|
|
full_name: str = None
|
|
|
|
|
|
# Don't do this in production!
|
|
@app.post("/user/", response_model=UserIn)
|
|
async def create_user(*, user: UserIn):
|
|
return user
|