mirror of
https://github.com/fastapi-users/fastapi-users.git
synced 2025-08-15 11:11:16 +08:00
Start foundations
This commit is contained in:
12
fastapi_users/router.py
Normal file
12
fastapi_users/router.py
Normal file
@ -0,0 +1,12 @@
|
||||
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)
|
Reference in New Issue
Block a user