2025-03-22 14:08:23 +01:00

30 lines
610 B
Python

from fastapi import APIRouter, HTTPException
users = [
{
"id": "1",
"username": "johndoe",
"email": "john@example.com",
"country": "France"
},
{
"id": "2",
"username": "janedoe",
"email": "jane@example.com",
"country": "Germany"
}
]
router = APIRouter()
@router.get("/users")
async def get_users():
"""Fetch list of users"""
if request.method != "GET":
raise HTTPException(status_code=405, detail="Method Not Allowed")
return {
"method": "GET",
"_verb": "get",
"users": users
}