feat: add ping endpoint

This commit is contained in:
Alexandre Teles 2022-11-17 02:12:52 -03:00
parent 1b10fe6e74
commit 0b45044649
3 changed files with 15 additions and 1 deletions

View File

@ -29,6 +29,7 @@ import app.models.GeneralErrors as GeneralErrors
from app.routers import root from app.routers import root
from app.routers import auth from app.routers import auth
from app.routers import items from app.routers import items
from app.routers import ping
"""Implements an API for our polling app""" """Implements an API for our polling app"""
@ -64,6 +65,7 @@ app.add_middleware(SlowAPIMiddleware)
app.include_router(root.router) app.include_router(root.router)
app.include_router(items.router) app.include_router(items.router)
app.include_router(auth.router) app.include_router(auth.router)
app.include_router(ping.router)
# Setup cache # Setup cache

View File

@ -9,4 +9,4 @@ class BallotModel(BaseModel):
""" """
discord_id_hash: str discord_id_hash: str
ballot: list[BallotFields] ballot: str

12
app/routers/ping.py Normal file
View File

@ -0,0 +1,12 @@
from fastapi import APIRouter, Request, Response
router = APIRouter()
@router.head('/ping', status_code=204, tags=['Ping'])
async def ping(request: Request, response: Response) -> None:
"""Check if the API is running.
Returns:
None
"""
return None