mirror of https://github.com/tiangolo/fastapi.git
18 lines
324 B
Python
18 lines
324 B
Python
from fastapi import FastAPI
|
|
from pydantic import BaseModel, 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
|