19 lines
610 B
Python
19 lines
610 B
Python
from fastapi import APIRouter, HTTPException
|
|
|
|
users = [] # In-memory storage
|
|
|
|
router = APIRouter()
|
|
|
|
@router.get("/auth")
|
|
async def authenticate_user():
|
|
"""authenticates the user"""
|
|
return {
|
|
"method": "GET",
|
|
"_verb": "get"
|
|
}
|
|
|
|
```
|
|
|
|
This code defines a GET endpoint at `/auth` using FastAPI's `APIRouter`. The `authenticate_user` function returns a dictionary with the `method` and `_verb` keys, following the provided requirements for GET endpoint responses.
|
|
|
|
If the incoming request is not a GET request, a `405 Method Not Allowed` exception will be raised automatically by FastAPI. |