health-apps-backend/apis/endpoints/auth.py

24 lines
626 B
Python

from fastapi import APIRouter
from services.authService import AuthService
from schemas.CreateSchemas import UserCreate
from schemas.ApiResponse import ApiResponse
router = APIRouter()
@router.post("/login")
async def login(email: str, password: str):
response = await AuthService().login(email, password)
return ApiResponse(
data=response,
message="Login successful"
)
@router.post("/register")
async def register(user_data: UserCreate):
response = await AuthService().register(user_data)
return ApiResponse(
data=response,
message="User registered successfully"
)