Skip to content

Commit

Permalink
Add health check API
Browse files Browse the repository at this point in the history
  • Loading branch information
cmyui committed Jun 22, 2024
1 parent 2eeed62 commit 596c72d
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
9 changes: 9 additions & 0 deletions app/api/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
from fastapi import APIRouter

from app.api.health import health_router
from app.api.v1 import v1_router

api_router = APIRouter()

api_router.include_router(v1_router)
api_router.include_router(health_router)
9 changes: 9 additions & 0 deletions app/api/health.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
from fastapi import APIRouter
from fastapi import Response

health_router = APIRouter()


@health_router.get("/_health")
async def healthcheck() -> Response:
return Response(status_code=200)
4 changes: 2 additions & 2 deletions app/init_api.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
from fastapi import FastAPI

from app.api.v1 import v1_router
from app.api import api_router


def init_api() -> FastAPI:
app = FastAPI()

app.include_router(v1_router)
app.include_router(api_router)

return app

Expand Down

0 comments on commit 596c72d

Please sign in to comment.