Skip to content

Commit 39ec46b

Browse files
committed
feat: add root redirect to /health
1 parent 202c3c7 commit 39ec46b

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

app/main.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
1-
21
from fastapi import FastAPI
2+
from fastapi.responses import RedirectResponse
33

44
app = FastAPI(title="DevOps Starter Kit")
55

6+
@app.get("/", include_in_schema=False)
7+
def root():
8+
# keep one source of truth for health
9+
return RedirectResponse(url="/health", status_code=307)
10+
611
@app.get("/health")
712
def health():
813
return {"status": "ok"}

0 commit comments

Comments
 (0)