mirror of
https://github.com/fastapi-users/fastapi-users.git
synced 2025-08-14 18:58:10 +08:00
13 lines
319 B
Python
13 lines
319 B
Python
from fastapi import APIRouter
|
|
|
|
from .models import UserCreate, UserDB
|
|
from .password import get_password_hash
|
|
|
|
router = APIRouter()
|
|
|
|
|
|
@router.post('/register')
|
|
async def register(user: UserCreate):
|
|
hashed_password = get_password_hash(user.password)
|
|
return UserDB(**user.dict(), hashed_password=hashed_password)
|