30 lines
640 B
Python
30 lines
640 B
Python
from fastapi import APIRouter, HTTPException
|
|
|
|
users = [
|
|
{
|
|
"id": "1",
|
|
"email": "user1@example.com",
|
|
"password": "password1",
|
|
"disabled": False
|
|
},
|
|
{
|
|
"id": "2",
|
|
"email": "user2@example.com",
|
|
"password": "password2",
|
|
"disabled": True
|
|
}
|
|
]
|
|
|
|
router = APIRouter()
|
|
|
|
@router.get("/users", response_model=list)
|
|
async def get_users():
|
|
"""Get all registered users"""
|
|
if request.method != "GET":
|
|
raise HTTPException(status_code=405, detail="Method Not Allowed")
|
|
|
|
return {
|
|
"method": "GET",
|
|
"_verb": "get",
|
|
"users": users
|
|
} |